Giter VIP home page Giter VIP logo

promice's Introduction

PROMICE - A Python interface to PROMICE data

Table of contents

WARNING

  • This is alpha level software under development.
  • Please contact Ken Mankoff <[email protected]> before using.

Installation

pip install git+https://gitlab.com/mankoff/PROMICE.git

Can be run in new environment, for example:

Conda:

conda create -n PROMICE python=3.8
conda activate PROMICE
pip install --upgrade git+https://gitlab.com/mankoff/PROMICE.git

Test the installation

conda activate PROMICE
python

Then,

import promice
promice.ice_discharge.discharge(resolution="GIS").to_dataframe().tail()
timedischargeerrcoverage
2020-06-11508.73901452.5740010.805
2020-06-23509.87500052.7020000.718
2020-07-05509.69500752.2090000.668
2020-07-17506.66598551.7719990.713
2020-07-29502.26300051.3250010.714

Quickstart

Ice Discharge

from promice import ice_discharge as ice
ds = ice.discharge(resolution="GIS")
ds.to_dataframe().tail()
timedischargeerrcoverage
2020-06-11 00:00:00508.73952.5740.805
2020-06-23 00:00:00509.87552.7020.718
2020-07-05 00:00:00509.69552.2090.668
2020-07-17 00:00:00506.66651.7720.713
2020-07-29 00:00:00502.26351.3250.714

Find the 2020 discharge for the top 3 discharging glaciers

Load an xarray dataset of all discharge

from promice import ice_discharge as ice
ds = ice.discharge(resolution="gate")
print(ds)
<xarray.Dataset>
Dimensions:        (gate: 267, time: 449)
Coordinates:
  * time           (time) datetime64[ns] 1986-04-15 1986-05-15 ... 2020-07-29
  * gate           (gate) int64 1 3 4 5 6 7 8 10 ... 350 352 353 354 355 356 357
Data variables:
    discharge      (gate, time) float32 ...
    err            (gate, time) float32 ...
    coverage       (gate, time) float32 ...
    mean_x         (gate) int32 ...
    mean_y         (gate) int32 ...
    mean_lon       (gate) float32 ...
    mean_lat       (gate) float32 ...
    sector         (gate) int32 ...
    region         (gate) object ...
    name_Bjørk     (gate) object ...
    name_Mouginot  (gate) object ...
Attributes:
    featureType:      timeSeries
    title:            Greenland discharge
    summary:          Greenland discharge per gate
    keywords:         Greenland; Ice Discharge; Calving; Submarine Melt
    source:           git commit: b4f3e88
    creator_name:     Ken Mankoff
    creator_email:    [email protected]
    creator_url:      http://kenmankoff.com
    institution:      GEUS
    references:       10.22008/promice/ice_discharge
    product_version:  [2.]
top3 = ds.resample(time='A')\
         .mean()['discharge']\
         .to_dataframe()['discharge']\
         .unstack()\
         .iloc[-1]\
         .sort_values(ascending=False)[0:3]
top3
gate
184    34.403828
231    33.083332
190    27.318832
Name: 2020-12-31 00:00:00, dtype: float32
df_3 = ds.sel(gate=top3.index)\
         .to_dataframe()['discharge']\
         .unstack()\
         .T

df_3.head()
time184190231
1986-04-15 00:00:0023.17415.26729.657
1986-05-15 00:00:0030.0715.88333.243
1986-06-15 00:00:0030.00616.71431.41
1986-07-15 00:00:0029.94416.8533.052
1986-08-15 00:00:0029.8816.14831.726
  • Convert the gate ID to named glacier
  • Subset to just 2020
  • Monthly average
df_3.rename(inplace=True, columns=dict([(i, str(ds.sel({'gate':i})['name_Bjørk'].values)) for i in df_3.columns]))
df_3[df_3.index.year >= 2020].resample('M').mean()
timeSermeq KujalleqKangerlussuaq GletsjerHelheim Gletsjer
2020-01-31 00:00:0032.685327.94135.2233
2020-02-29 00:00:0031.46527.52335.2225
2020-03-31 00:00:0031.130327.377334.3623
2020-04-30 00:00:0031.833528.287534.657
2020-05-31 00:00:0034.573727.031731.8193
2020-06-30 00:00:0039.909526.923530.3435
2020-07-31 00:00:0039.228326.40730.2797

Watson River discharge

from promice import watson
df = watson.discharge()
df['2012-06-01':].head(3)
DateQerr
2012-06-01 00:00:000.170.04
2012-06-02 00:00:000.210.05
2012-06-03 00:00:000.260.06

promice's People

Contributors

dependabot[bot] avatar mankoff avatar pennyhow avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

davidripsen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.