Skip to content

Latest commit

 

History

History
462 lines (410 loc) · 27.1 KB

GL_discharge.org

File metadata and controls

462 lines (410 loc) · 27.1 KB

Table of contents

Introduction

Greenland discharge is repackaged from:

WARNING

This product is generated from flux gates ~5 km upstream of the terminus.

It lacks

Data example

Printout

<xarray.Dataset> Size: 12kB
Dimensions:      (region: 7, time: 186)
Coordinates:
  * time         (time) datetime64[ns] 1kB 1840-01-01 1841-01-01 ... 2025-01-01
  * region       (region) int32 28B 1 2 3 4 5 6 7
Data variables:
    discharge    (region, time) float32 5kB ...
    err          (region, time) float32 5kB ...
    region_name  (region) <U2 56B ...
Attributes: (12/14)
    featureType:      timeSeries
    title:            Greenland ice sheet discharge by Mouginot region
    summary:          Greenland ice sheet discharge by Mouginot region
    keywords:         Greenland; Mass; Mass balance
    source:           git commit: 54a4452
    creator_name:     Ken Mankoff
    ...               ...
    institution:      NASA GISS
    references:       TBD
    product_version:  1.0
    history:          TBD
    Conventions:      CF-1.8
    DOI:              https://doi.org/10.5281/zenodo.14020895

Plot: Annual discharge per region

import xarray as xr
ds = xr.open_dataset('dat/GL_discharge.nc')
df = ds['discharge'].to_dataframe()['discharge']

df = df.unstack().T
df.columns = ds['region_name'].values
ax = df.plot(drawstyle='steps-post')
_ = ax.set_ylabel('Discharge [Gt yr$^{-1}$]')

./fig/GL_discharge.png

Table: Annual discharge per region

import xarray as xr
ds = xr.open_dataset('dat/GL_discharge.nc')
ds = ds.sel({'time': slice('1800-01-01','2024-12-31')})
df = ds['discharge'].to_dataframe()['discharge']
df = df.unstack().T
df.columns = [str(_[0]) + ' ['+_[1]+']' for _ in zip(ds['region'].values, ds['region_name'].values)]
df['GL'] = df.sum(axis='columns')
df.index = [str(_)[0:4] for _ in df.index]
df.round()
1 [CE]2 [CW]3 [NE]4 [NO]5 [NW]6 [SE]7 [SW]GL
1840616120218311818382
1841616120218311818382
1842616120218311818382
1843616120218311818382
1844616120218311818382
1845626220228512118391
1846626220228512018388
1847626220228512118389
1848636321228712418399
1849636321228712318397
1850636321228712418399
1851626220228512118391
1852646421228812519403
1853656622239012819412
1854656521238912719409
1855656521238912619407
1856646421238912619406
1857666622239012819414
1858656521239012719411
1859646421228812519404
1860646421228812519402
1861636421228712418400
1862636321228612218395
1863606020218211717378
1864585919208011417368
1865585819208011417367
1866575719207911217361
1867595919218111517369
1868585819208011317366
1869595919218111617373
1870606020218311717378
1871626220228512018388
1872636421228712418400
1873636321228612218395
1874646421228812519402
1875646421228812519402
1876646421228712418401
1877646421228812519402
1878636321228612218395
1879636321228712318398
1880636421228712418400
1881646421228812419401
1882646421228712418401
1883636321228612318396
1884626220228512118391
1885626220228512118391
1886626220228512018388
1887626220228512018388
1888636421228712418400
1889636321228712318397
1890646421228712418401
1891646421228812519404
1892656521238912719409
1893666622239012819414
1894646421228812519404
1895656521238912619407
1896656521238912719408
1897656521238912619407
1898646421228812419401
1899636321228712418399
1900656521239012719411
1901656521238912619407
1902666622239012819413
1903656622239012819413
1904676722239213119422
1905676722239213019421
1906666622239112919416
1907676722239213119421
1908676722239213119421
1909686822249313220425
1910676722239213119422
1911676722249213120423
1912676722249313220425
1913676722249313120424
1914656521239012719410
1915656521238912719410
1916656521238912719409
1917656522239012719411
1918646421228812519403
1919636321228712418399
1920646421228812519404
1921646421228812419401
1922636321228612218395
1923636321228612318396
1924646421228812519404
1925646421238812519405
1926666622239112919415
1927676722249213120422
1928707023259613720442
1929717123259713821445
1930717123259713821446
19317474242610214522467
19327474242610114421465
19337474242610214422466
19347373242510014221458
19357373242610114321461
19367474242610214421465
1937727224259914021453
1938717123259813921448
1939717224259813921450
1940717123259713821446
1941707123259713820444
1942707023249613620438
1943696923249513520437
1944697023249513620437
1945686822249413320429
1946686822249413320429
1947676822249313220425
1948686822249413320430
1949696923249513520435
1950707023249613620440
1951717123259713821445
1952717123259813921449
1953717123259813921448
1954707023259613720441
1955696923249413420432
1956686822249313220426
1957686822249413320430
1958686923249413420431
1959686822249413320430
1960707023259613720441
1961717123259813921447
1962727224259914021453
1963707023259713720442
1964696923249513420434
1965696923249513520436
1966686822249313320428
1967676722249313120424
1968676722249213120423
1969676722249313220424
1970676722239213119421
1971676722239213119421
1972656521239012719411
1973656521238912619408
1974646521238912619406
1975656521238912719408
1976656622239012819413
1977666622239012819414
1978676722249213120423
1979686822249313220425
1980676822249313220425
1981686822249313220426
1982686822249313220427
1983666622239112919418
1984666622239112919416
1985676722239213119421
1986647322239314221438
1987657223249014321437
1988677022239313221427
1989687122239912621431
19907068222310212722433
1991706723239712922432
1992736823239513221436
1993736724239613220435
1994676724259413618432
1995626422269113718420
1996656621259013620424
1997666820239013420421
1998677222229013018421
1999667322258913218426
2000667822249013020430
2001667923238812519424
2002698025238913219438
2003738324239213820452
2004778323249514520466
2005838324239614620475
2006828524249413920469
2007788524259413619462
2008768625269714019468
2009758824239914319472
20107488252710014418476
20117588252510414420481
20127593252410314020480
20137594262410614220486
20147293272610814019485
20157292282610814219487
20167189282611013719481
20177681292711214719490
20187978302811314519491
20198079302810915219497
20208484302710815319506
20218189302711015120507
20228383302611214919503
20238083302611014218490
20247984302611314019491
df.describe().round()
1 [CE]2 [CW]3 [NE]4 [NO]5 [NW]6 [SE]7 [SW]GL
count185185185185185185185185
mean676922239213119424
std582278130
min575719207911217361
25%646421228812518402
50%666722239113019421
75%707123249513620438
max8494302811315322507

Fetch data

export SERVER_URL=https://dataverse.geus.dk
export PERSISTENT_IDENTIFIER=doi:10.22008/FK2/OHI23Z
export METADATA_FORMAT=dataverse_json # ddi dataverse_json schema.org Datacite oai_datacite
curl "$SERVER_URL/api/datasets/export?exporter=$METADATA_FORMAT&persistentId=$PERSISTENT_IDENTIFIER" | jq .datasetVersion.versionNumber
890
mkdir -p tmp/greenland_discharge
pushd tmp/greenland_discharge

# wget -r -e robots=off -nH --cut-dirs=3 --content-disposition "https://dataverse.geus.dk/api/datasets/:persistentId/dirindex?persistentId=doi:10.22008/FK2/OHI23Z"
wget https://thredds.geus.dk/thredds/fileServer/MassBalance/MB_region.nc -O MB_region.nc
popd

Reprocess

  • Annual discharge
  • Group by ROI
import xarray as xr
import numpy as np

ds = xr.open_dataset('./tmp/greenland_discharge/MB_region.nc')

# Limit to discharge
ds = ds[['D_ROI','D_ROI_err','D']]

# Drop partial years
this_yr = ds['time'].to_series().iloc[-1].year
ds = ds.sel({'time':slice('1800',str(this_yr))})

# Scale early values to annual
ds.loc[{'time': slice('1840-01-01','1985-12-31')}] *= 365

# Resample by year
ds = ds.resample({'time':'YS'}).sum()

# Prior to 1986 there is no regional resolution, just one value for all of Greenland.

# Split into regions by taking the 1990s percent of discharge per region, and assuming the historical GIS-wide discharge maintained that distribution (even if magnitude changed).

ds_ratio = ds['D_ROI'].loc[{'time': slice('1990-01-01','1999-12-31')}].sum(dim='time')
ds_ratio = ds_ratio / sum(ds_ratio)
# print(ds_ratio)

for r in ds['region']:
    # Set regional values to the average of the first 5 years when there is regional resolution
    ds['D_ROI'].sel({'region':r}).loc[{'time': slice('1840-01-01','1985-12-31')}] = ds['D'].loc[{'time': slice('1840-01-01','1985-12-31')}] * ds_ratio.sel(region=r.values).values
    # Set regional uncertainty to the full range of observed values
    errmax = ds['D_ROI'].sel({'region':r, 'time':slice('1986-01-01','1999-12-31')}).max()
    errmin = ds['D_ROI'].sel({'region':r, 'time':slice('1986-01-01','1999-12-31')}).min()
    ds['D_ROI_err'].sel({'region':r}).loc[{'time': slice('1840-01-01','1985-12-31')}] = (errmax-errmin)

ds = ds.transpose()

ds = ds.rename({'D_ROI':'discharge','D_ROI_err':'err'})
ds = ds.drop_vars('D')

ds['discharge'].attrs['units'] = 'Gt yr-1'
ds['err'].attrs['units'] = 'Gt yr-1'

ds['discharge'].attrs['long_name'] = 'Marine discharge. Includes both calving and submarine melt. Some calving is equivalent to submarine melt if using at fjord mouth'

ds = ds.sortby('region')
ds = ds.rename_dims({'region': 'region_name'})
ds = ds.rename({'region': 'region_name'})
ds = ds.set_index(region_name='region_name')

ds['region'] = (('region_name'),np.arange(7).astype(np.int32) + 1)
ds = ds.set_coords('region')
ds = ds.swap_dims({'region_name':'region'})
ds = ds.reset_coords('region_name')

ds['discharge'].attrs['standard_name'] = 'tendency_of_land_ice_mass_due_to_calving'
ds['discharge'].attrs['units'] = 'Gt yr-1'
ds['err'].attrs['standard_name'] = 'tendency_of_land_ice_mass_due_to_calving'

ds['time'].attrs['long_name'] = 'time'
ds['region'].attrs['long_name'] = 'Mouginot (2019) region'

ds.attrs['title'] = 'Greenland ice sheet discharge by Mouginot region'
ds.attrs['history'] = 'TBD'
ds.attrs['Conventions'] = 'CF-1.8'

ds.attrs['summary'] = 'Greenland ice sheet discharge by Mouginot region'
ds.attrs['creator_name'] = 'Ken Mankoff'
ds.attrs['creator_email'] = '[email protected]'
ds.attrs['institution'] = 'NASA GISS'
ds.attrs['references'] = 'TBD'
ds.attrs['DOI'] = 'https://doi.org/10.5281/zenodo.14020895'

comp = dict(zlib=True, complevel=5)
encoding = {} # var: comp for var in items}
encoding['time'] = {'dtype': 'i4'}

!rm ./dat/GL_discharge.nc
ds.to_netcdf('./dat/GL_discharge.nc', encoding=encoding)
!ncdump -h ./dat/GL_discharge.nc
netcdf GL_discharge {
dimensions:
	region = 7 ;
	time = 186 ;
variables:
	float discharge(region, time) ;
		discharge:_FillValue = NaNf ;
		discharge:long_name = "Marine discharge. Includes both calving and submarine melt. Some calving is equivalent to submarine melt if using at fjord mouth" ;
		discharge:standard_name = "tendency_of_land_ice_mass_due_to_calving" ;
		discharge:units = "Gt yr-1" ;
	float err(region, time) ;
		err:_FillValue = NaNf ;
		err:long_name = "Marine mass balance uncertainty" ;
		err:standard_name = "tendency_of_land_ice_mass_due_to_calving" ;
		err:units = "Gt yr-1" ;
	string region_name(region) ;
		region_name:long_name = "Mouginot 2019 regions" ;
	int time(time) ;
		time:cf_role = "timeseries_id" ;
		time:standard_name = "time" ;
		time:axis = "T" ;
		time:long_name = "time" ;
		time:units = "days since 1840-01-01 00:00:00" ;
		time:calendar = "proleptic_gregorian" ;
	int region(region) ;
		region:long_name = "Mouginot (2019) region" ;

// global attributes:
		:featureType = "timeSeries" ;
		:title = "Greenland ice sheet discharge by Mouginot region" ;
		:summary = "Greenland ice sheet discharge by Mouginot region" ;
		:keywords = "Greenland; Mass; Mass balance" ;
		:source = "git commit: 54a4452" ;
		:creator_name = "Ken Mankoff" ;
		:creator_email = "[email protected]" ;
		:creator_url = "http://kenmankoff.com" ;
		:institution = "NASA GISS" ;
		:references = "TBD" ;
		:product_version = 1. ;
		:history = "TBD" ;
		:Conventions = "CF-1.8" ;
		:DOI = "https://doi.org/10.5281/zenodo.14020895" ;
}
/tmp/ipykernel_613332/4182150838.py:47: UserWarning: rename 'region' to 'region_name' does not create an index anymore. Try using swap_dims instead or use set_index after rename to create an indexed coordinate.
  ds = ds.rename({'region': 'region_name'})