{ "cells": [ { "cell_type": "markdown", "id": "3c884e15-ff3b-44cc-9681-c5c77f7f7936", "metadata": {}, "source": [ "# RGI7 attributes metadata" ] }, { "cell_type": "markdown", "id": "b078e32e-ffed-432f-9faa-e5409b542544", "metadata": {}, "source": [ "## Glacier product " ] }, { "cell_type": "code", "execution_count": 1, "id": "2e620671-ce52-4390-aad6-32d55ab0f39b", "metadata": {}, "outputs": [], "source": [ "attrs = {\n", " 'rgi_id': {\n", " 'long_name': 'RGI identifier',\n", " 'description': 'Unique identifier assigned to a single outline.',\n", " 'datatype': 'str',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'RGI_Id',\n", " },\n", " 'o1region': {\n", " 'long_name': 'First order region',\n", " 'description': 'The code of the first-order region to which the glacier belongs.',\n", " 'datatype': 'str',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'O1Region',\n", " },\n", " 'o2region': {\n", " 'long_name': 'Second order region',\n", " 'description': 'The code of the second-order region to which the glacier belongs.',\n", " 'datatype': 'str',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'O2Region',\n", " },\n", " 'glims_id': {\n", " 'long_name': 'GLIMS identifier',\n", " 'description': 'Non-unique identifier assigned to glaciers by the Global Land Ice Measurements from Space service at NSIDC.',\n", " 'datatype': 'str',\n", " 'units': '',\n", " 'source': 'GLIMS',\n", " 'rgi6_name': 'GLIMS_Id',\n", " },\n", " 'anlys_id': {\n", " 'long_name': 'Analysis identifier',\n", " 'description': 'The unique identifier assigned within GLIMS for a particular outline of a glacier at a particular time.',\n", " 'datatype': 'int',\n", " 'units': '',\n", " 'source': 'GLIMS',\n", " 'rgi6_name': '',\n", " },\n", " 'subm_id': {\n", " 'long_name': 'Submission identifier',\n", " 'description': 'Unique identifier assigned by GLIMS to a specific data submission. Allows to obtain information about the analysts and data submitters.',\n", " 'datatype': 'int',\n", " 'units': '',\n", " 'source': 'GLIMS',\n", " 'rgi6_name': '',\n", " },\n", " 'src_date': {\n", " 'long_name': 'Outline source date',\n", " 'description': 'The as-of date for the outline (usually the acquisition date of the image), in the format ISO 8601.',\n", " 'datatype': 'str',\n", " 'units': 'date',\n", " 'source': 'GLIMS',\n", " 'rgi6_name': 'BgnDate',\n", " },\n", " 'cenlon': {\n", " 'long_name': 'Center longitude',\n", " 'description': 'Longitude of an approximately central point within the glacier outlines (not the centroid).',\n", " 'datatype': 'float',\n", " 'units': 'degrees',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'CenLon',\n", " }, \n", " 'cenlat': {\n", " 'long_name': 'Center latitude',\n", " 'description': 'Latitude of an approximately central point within the glacier outlines (not the centroid).',\n", " 'datatype': 'float',\n", " 'units': 'degrees',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'CenLat',\n", " }, \n", " 'utm_zone': {\n", " 'long_name': 'UTM zone',\n", " 'description': 'Number of the UTM zone for this glacier, based on its representative point. Note that this attribute is for information only, the geometries are all in WGS84.',\n", " 'datatype': 'int',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " }, \n", " 'area_km2': {\n", " 'long_name': 'Glacier area',\n", " 'description': 'Area of the glacier.',\n", " 'datatype': 'float',\n", " 'units': 'km2',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'Area',\n", " }, \n", " 'primeclass': {\n", " 'long_name': 'Primary classification',\n", " 'description': 'WGMS primary classification of the glacier. For a categories description, see user guide.',\n", " 'datatype': 'int',\n", " 'units': '',\n", " 'source': 'GLIMS',\n", " 'rgi6_name': '',\n", " }, \n", " 'conn_lvl': {\n", " 'long_name': 'Connectivity level',\n", " 'description': 'Level of connection to the Greenland Icesheet (0: no connection; 1: weak connection).',\n", " 'datatype': 'int',\n", " 'units': '',\n", " 'source': 'GLIMS',\n", " 'rgi6_name': 'Connect',\n", " }, \n", " 'surge_type': {\n", " 'long_name': 'Evidence for surging',\n", " 'description': 'Flag indicating if surging behavior has been documented for this glacier. For a categories description, see user guide.',\n", " 'datatype': 'int',\n", " 'units': '',\n", " 'source': 'GLIMS',\n", " 'rgi6_name': 'Surging',\n", " }, \n", " 'term_type': {\n", " 'long_name': 'Glacier terminus type',\n", " 'description': 'Flag indicating the terminus type of the glacier. For a categories description, see user guide.',\n", " 'datatype': 'int',\n", " 'units': '',\n", " 'source': 'GLIMS',\n", " 'rgi6_name': 'TermType',\n", " }, \n", " 'glac_name': {\n", " 'long_name': 'Glacier name',\n", " 'description': 'Glacier name (when available).',\n", " 'datatype': 'str',\n", " 'units': '',\n", " 'source': 'GLIMS',\n", " 'rgi6_name': 'Name',\n", " }, \n", " 'is_rgi6': {\n", " 'long_name': 'Same as RGI 6.0 outline',\n", " 'description': 'Flag indicating if the outline is the same as in RGI 6.0 (1) or was remapped (0). Note that it does not guarantee strict equivalence of the polygon (in most of the cases it does).',\n", " 'datatype': 'int',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " }, \n", " 'termlon': {\n", " 'long_name': 'Terminus longitude',\n", " 'description': 'Longitude of the lowest elevation point on the glacier outline.',\n", " 'datatype': 'float',\n", " 'units': 'degrees',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " }, \n", " 'termlat': {\n", " 'long_name': 'Terminus latitude',\n", " 'description': 'Latitude of the lowest elevation point on the glacier outline.',\n", " 'datatype': 'float',\n", " 'units': 'degrees',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " }, \n", " 'zmin_m': {\n", " 'long_name': 'Minimum elevation',\n", " 'description': 'Minimum elevation (m above sea level) of the glacier.',\n", " 'datatype': 'float',\n", " 'units': 'm',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'Zmin',\n", " }, \n", " 'zmax_m': {\n", " 'long_name': 'Maximum elevation',\n", " 'description': 'Maximum elevation (m above sea level) of the glacier.',\n", " 'datatype': 'float',\n", " 'units': 'm',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'Zmax',\n", " }, \n", " 'zmed_m': {\n", " 'long_name': 'Median elevation',\n", " 'description': 'Median elevation (m above sea level) of the glacier.',\n", " 'datatype': 'float',\n", " 'units': 'm',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'Zmed',\n", " }, \n", " 'zmean_m': {\n", " 'long_name': 'Mean elevation',\n", " 'description': 'Mean elevation (m above sea level) of the glacier.',\n", " 'datatype': 'float',\n", " 'units': 'm',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " }, \n", " 'slope_deg': {\n", " 'long_name': 'Mean slope',\n", " 'description': 'Mean slope of the glacier surface.',\n", " 'datatype': 'float',\n", " 'units': 'degrees',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'Slope',\n", " }, \n", " 'aspect_deg': {\n", " 'long_name': 'Aspect',\n", " 'description': 'The aspect (orientation) of the glacier surface presented as an azimuth relative to 0° at due north.',\n", " 'datatype': 'float',\n", " 'units': 'degrees',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'Aspect',\n", " },\n", " 'aspect_sec': {\n", " 'long_name': 'Aspect sector',\n", " 'description': 'The aspect (orientation) of the glacier surface presented as a category. For a categories description, see user guide.',\n", " 'datatype': 'int',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", " 'dem_source': {\n", " 'long_name': 'DEM data source',\n", " 'description': 'The name of the dataset that was used to compute the topography attributes.',\n", " 'datatype': 'str',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", " 'lmax_m': {\n", " 'long_name': 'Maximum length',\n", " 'description': 'Length (m) of the longest surface centerline of the glacier.',\n", " 'datatype': 'int',\n", " 'units': 'm',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'Lmax',\n", " },\n", " 'geometry': {\n", " 'long_name': 'Geometry',\n", " 'description': 'Glacier geometry (Polygon)',\n", " 'datatype': '',\n", " 'units': 'deg',\n", " 'source': 'GLIMS',\n", " 'rgi6_name': 'geometry',\n", " },\n", "}" ] }, { "cell_type": "code", "execution_count": 2, "id": "c0d4f684-6a9c-46f4-af49-02cbfb0afe36", "metadata": {}, "outputs": [], "source": [ "import json" ] }, { "cell_type": "code", "execution_count": 3, "id": "14297dda-944f-4e2e-844f-027e1b75366b", "metadata": {}, "outputs": [], "source": [ "with open('rgi7_attributes_metadata.json', 'w') as outfile:\n", " json.dump(attrs, outfile, indent=2)" ] }, { "cell_type": "markdown", "id": "89096422-84ea-4040-90a6-eadb6aa4e5e3", "metadata": {}, "source": [ "### To Markdown " ] }, { "cell_type": "code", "execution_count": 4, "id": "03997530-47c8-4dd7-8b21-6bbf0d631f43", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "`rgi_id`\n", ": `long_name`: RGI identifier
`description`: Unique identifier assigned to a single outline.
`datatype`: str
`units`:
`source`: RGI
`rgi6_name`: RGI_Id\n", "\n", "`o1region`\n", ": `long_name`: First order region
`description`: The code of the first-order region to which the glacier belongs.
`datatype`: str
`units`:
`source`: RGI
`rgi6_name`: O1Region\n", "\n", "`o2region`\n", ": `long_name`: Second order region
`description`: The code of the second-order region to which the glacier belongs.
`datatype`: str
`units`:
`source`: RGI
`rgi6_name`: O2Region\n", "\n", "`glims_id`\n", ": `long_name`: GLIMS identifier
`description`: Non-unique identifier assigned to glaciers by the Global Land Ice Measurements from Space service at NSIDC.
`datatype`: str
`units`:
`source`: GLIMS
`rgi6_name`: GLIMS_Id\n", "\n", "`anlys_id`\n", ": `long_name`: Analysis identifier
`description`: The unique identifier assigned within GLIMS for a particular outline of a glacier at a particular time.
`datatype`: int
`units`:
`source`: GLIMS
`rgi6_name`: \n", "\n", "`subm_id`\n", ": `long_name`: Submission identifier
`description`: Unique identifier assigned by GLIMS to a specific data submission. Allows to obtain information about the analysts and data submitters.
`datatype`: int
`units`:
`source`: GLIMS
`rgi6_name`: \n", "\n", "`src_date`\n", ": `long_name`: Outline source date
`description`: The as-of date for the outline (usually the acquisition date of the image), in the format ISO 8601.
`datatype`: str
`units`: date
`source`: GLIMS
`rgi6_name`: BgnDate\n", "\n", "`cenlon`\n", ": `long_name`: Center longitude
`description`: Longitude of an approximately central point within the glacier outlines (not the centroid).
`datatype`: float
`units`: degrees
`source`: RGI
`rgi6_name`: CenLon\n", "\n", "`cenlat`\n", ": `long_name`: Center latitude
`description`: Latitude of an approximately central point within the glacier outlines (not the centroid).
`datatype`: float
`units`: degrees
`source`: RGI
`rgi6_name`: CenLat\n", "\n", "`utm_zone`\n", ": `long_name`: UTM zone
`description`: Number of the UTM zone for this glacier, based on its representative point. Note that this attribute is for information only, the geometries are all in WGS84.
`datatype`: int
`units`:
`source`: RGI
`rgi6_name`: \n", "\n", "`area_km2`\n", ": `long_name`: Glacier area
`description`: Area of the glacier.
`datatype`: float
`units`: km2
`source`: RGI
`rgi6_name`: Area\n", "\n", "`primeclass`\n", ": `long_name`: Primary classification
`description`: WGMS primary classification of the glacier. For a categories description, see user guide.
`datatype`: int
`units`:
`source`: GLIMS
`rgi6_name`: \n", "\n", "`conn_lvl`\n", ": `long_name`: Connectivity level
`description`: Level of connection to the Greenland Icesheet (0: no connection; 1: weak connection).
`datatype`: int
`units`:
`source`: GLIMS
`rgi6_name`: Connect\n", "\n", "`surge_type`\n", ": `long_name`: Evidence for surging
`description`: Flag indicating if surging behavior has been documented for this glacier. For a categories description, see user guide.
`datatype`: int
`units`:
`source`: GLIMS
`rgi6_name`: Surging\n", "\n", "`term_type`\n", ": `long_name`: Glacier terminus type
`description`: Flag indicating the terminus type of the glacier. For a categories description, see user guide.
`datatype`: int
`units`:
`source`: GLIMS
`rgi6_name`: TermType\n", "\n", "`glac_name`\n", ": `long_name`: Glacier name
`description`: Glacier name (when available).
`datatype`: str
`units`:
`source`: GLIMS
`rgi6_name`: Name\n", "\n", "`is_rgi6`\n", ": `long_name`: Same as RGI 6.0 outline
`description`: Flag indicating if the outline is the same as in RGI 6.0 (1) or was remapped (0). Note that it does not guarantee strict equivalence of the polygon (in most of the cases it does).
`datatype`: int
`units`:
`source`: RGI
`rgi6_name`: \n", "\n", "`termlon`\n", ": `long_name`: Terminus longitude
`description`: Longitude of the lowest elevation point on the glacier outline.
`datatype`: float
`units`: degrees
`source`: RGI
`rgi6_name`: \n", "\n", "`termlat`\n", ": `long_name`: Terminus latitude
`description`: Latitude of the lowest elevation point on the glacier outline.
`datatype`: float
`units`: degrees
`source`: RGI
`rgi6_name`: \n", "\n", "`zmin_m`\n", ": `long_name`: Minimum elevation
`description`: Minimum elevation (m above sea level) of the glacier.
`datatype`: float
`units`: m
`source`: RGI
`rgi6_name`: Zmin\n", "\n", "`zmax_m`\n", ": `long_name`: Maximum elevation
`description`: Maximum elevation (m above sea level) of the glacier.
`datatype`: float
`units`: m
`source`: RGI
`rgi6_name`: Zmax\n", "\n", "`zmed_m`\n", ": `long_name`: Median elevation
`description`: Median elevation (m above sea level) of the glacier.
`datatype`: float
`units`: m
`source`: RGI
`rgi6_name`: Zmed\n", "\n", "`zmean_m`\n", ": `long_name`: Mean elevation
`description`: Mean elevation (m above sea level) of the glacier.
`datatype`: float
`units`: m
`source`: RGI
`rgi6_name`: \n", "\n", "`slope_deg`\n", ": `long_name`: Mean slope
`description`: Mean slope of the glacier surface.
`datatype`: float
`units`: degrees
`source`: RGI
`rgi6_name`: Slope\n", "\n", "`aspect_deg`\n", ": `long_name`: Aspect
`description`: The aspect (orientation) of the glacier surface presented as an azimuth relative to 0° at due north.
`datatype`: float
`units`: degrees
`source`: RGI
`rgi6_name`: Aspect\n", "\n", "`aspect_sec`\n", ": `long_name`: Aspect sector
`description`: The aspect (orientation) of the glacier surface presented as a category. For a categories description, see user guide.
`datatype`: int
`units`:
`source`: RGI
`rgi6_name`: \n", "\n", "`dem_source`\n", ": `long_name`: DEM data source
`description`: The name of the dataset that was used to compute the topography attributes.
`datatype`: str
`units`:
`source`: RGI
`rgi6_name`: \n", "\n", "`lmax_m`\n", ": `long_name`: Maximum length
`description`: Length (m) of the longest surface centerline of the glacier.
`datatype`: int
`units`: m
`source`: RGI
`rgi6_name`: Lmax\n", "\n", "`geometry`\n", ": `long_name`: Geometry
`description`: Glacier geometry (Polygon)
`datatype`:
`units`: deg
`source`: GLIMS
`rgi6_name`: geometry\n", "\n" ] } ], "source": [ "for k, v in attrs.items():\n", " print(f'`{k}`')\n", " first = True\n", " for ik, iv in v.items():\n", " if first:\n", " print(f': `{ik}`: {iv}', end='')\n", " first = False\n", " else:\n", " print(f'
`{ik}`: {iv}', end='')\n", " print(f'')\n", " print(f'')" ] }, { "cell_type": "markdown", "id": "a4bca11e-ec9c-4a7e-b6be-7dbe3228743f", "metadata": {}, "source": [ "### Categorical" ] }, { "cell_type": "code", "execution_count": 5, "id": "43d10ec3-0bae-4665-ba2c-d973960a72f4", "metadata": {}, "outputs": [], "source": [ "from io import StringIO\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 6, "id": "bf01b270-9682-4db8-8dfb-74515db35d3c", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
ClassDescription
Digit
0MiscellaneousAny type not listed below (please explain)
1Continental ice sheetInundates areas of continental size
2IcefieldIce masses of sheet or blanket type of a thick...
3Ice capDome-shaped ice masses with radial flow
4Outlet glacierDrains an ice sheet, icefield or ice cap, usua...
5Valley glacierFlows down a valley; the catchment area is wel...
6Mountain glacierCirque, niche or crater type, hanging glacier;...
7Glacieret and snowfieldSmall ice masses of indefinite shape in hollow...
8Ice shelfFloating ice sheet of considerable thickness a...
9Rock glacierLava-stream-like debris mass containing ice in...
\n", "
" ], "text/plain": [ " Class \\\n", "Digit \n", "0 Miscellaneous \n", "1 Continental ice sheet \n", "2 Icefield \n", "3 Ice cap \n", "4 Outlet glacier \n", "5 Valley glacier \n", "6 Mountain glacier \n", "7 Glacieret and snowfield \n", "8 Ice shelf \n", "9 Rock glacier \n", "\n", " Description \n", "Digit \n", "0 Any type not listed below (please explain) \n", "1 Inundates areas of continental size \n", "2 Ice masses of sheet or blanket type of a thick... \n", "3 Dome-shaped ice masses with radial flow \n", "4 Drains an ice sheet, icefield or ice cap, usua... \n", "5 Flows down a valley; the catchment area is wel... \n", "6 Cirque, niche or crater type, hanging glacier;... \n", "7 Small ice masses of indefinite shape in hollow... \n", "8 Floating ice sheet of considerable thickness a... \n", "9 Lava-stream-like debris mass containing ice in... " ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data = StringIO(\"\"\"Digit,Class,Description\n", "0,Miscellaneous,\"Any type not listed below (please explain)\"\n", "1,Continental ice sheet,\"Inundates areas of continental size\"\n", "2,Icefield,\"Ice masses of sheet or blanket type of a thickness that is insufficient to obscure the subsurface topography\"\n", "3,Ice cap,\"Dome-shaped ice masses with radial flow\"\n", "4,Outlet glacier,\"Drains an ice sheet, icefield or ice cap, usually of valley glacier form; the catchment area may not be easily defined\"\n", "5,Valley glacier,\"Flows down a valley; the catchment area is well defined\"\n", "6,Mountain glacier,\"Cirque, niche or crater type, hanging glacier; includes ice aprons and groups of small units\"\n", "7,Glacieret and snowfield,\"Small ice masses of indefinite shape in hollows, river beds and on protected slopes, which has developed from snow drifting, avalanching, and/or particularly heavy accumulation in certain years; usually no marked flow pattern\" is visible; in existence for at least two consecutive years.\n", "8,Ice shelf,\"Floating ice sheet of considerable thickness attached to a coast nourished by a glacier(s); snow accumulation on its surface or bottom freezing\"\n", "9,Rock glacier,\"Lava-stream-like debris mass containing ice in several possible forms and moving slowly downslope\"\n", "\"\"\")\n", "df = pd.read_csv(data, sep=\",\", index_col=0)\n", "df" ] }, { "cell_type": "code", "execution_count": 7, "id": "cf84a58c-aabf-4beb-911a-f5dc5b580b53", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "| Digit | Class | Description |\n", "|--------:|:------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n", "| 0 | Miscellaneous | Any type not listed below (please explain) |\n", "| 1 | Continental ice sheet | Inundates areas of continental size |\n", "| 2 | Icefield | Ice masses of sheet or blanket type of a thickness that is insufficient to obscure the subsurface topography |\n", "| 3 | Ice cap | Dome-shaped ice masses with radial flow |\n", "| 4 | Outlet glacier | Drains an ice sheet, icefield or ice cap, usually of valley glacier form; the catchment area may not be easily defined |\n", "| 5 | Valley glacier | Flows down a valley; the catchment area is well defined |\n", "| 6 | Mountain glacier | Cirque, niche or crater type, hanging glacier; includes ice aprons and groups of small units |\n", "| 7 | Glacieret and snowfield | Small ice masses of indefinite shape in hollows, river beds and on protected slopes, which has developed from snow drifting, avalanching, and/or particularly heavy accumulation in certain years; usually no marked flow pattern is visible; in existence for at least two consecutive years. |\n", "| 8 | Ice shelf | Floating ice sheet of considerable thickness attached to a coast nourished by a glacier(s); snow accumulation on its surface or bottom freezing |\n", "| 9 | Rock glacier | Lava-stream-like debris mass containing ice in several possible forms and moving slowly downslope |\n" ] } ], "source": [ "print(df.to_markdown())" ] }, { "cell_type": "code", "execution_count": 8, "id": "16b30155-5b89-4ddc-b786-896e0d922028", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Surging
Value
0No evidence
1Possible
2Probable
3Observed
9Not assigned
\n", "
" ], "text/plain": [ " Surging\n", "Value \n", "0 No evidence\n", "1 Possible\n", "2 Probable\n", "3 Observed\n", "9 Not assigned" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data = StringIO(\"\"\"Value,Surging\n", "0,\"No evidence\"\n", "1,\"Possible\"\n", "2,\"Probable\"\n", "3,\"Observed\"\n", "9,\"Not assigned\"\n", "\"\"\")\n", "df = pd.read_csv(data, sep=\",\", index_col=0)\n", "df" ] }, { "cell_type": "code", "execution_count": 9, "id": "4e559673-f783-499e-8d80-1cb1cc45f044", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "| Value | Surging |\n", "|--------:|:-------------|\n", "| 0 | No evidence |\n", "| 1 | Possible |\n", "| 2 | Probable |\n", "| 3 | Observed |\n", "| 9 | Not assigned |\n" ] } ], "source": [ "print(df.to_markdown())" ] }, { "cell_type": "code", "execution_count": 10, "id": "b0f713e9-7ba0-4afd-a83a-f6e08d8833ed", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Terminus type
Value
0Land-terminating
1Marine-terminating
2Lake-terminating
3Shelf-terminating
9Not assigned
\n", "
" ], "text/plain": [ " Terminus type\n", "Value \n", "0 Land-terminating\n", "1 Marine-terminating\n", "2 Lake-terminating\n", "3 Shelf-terminating\n", "9 Not assigned" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data = StringIO(\"\"\"Value,Terminus type\n", "0,\"Land-terminating\"\n", "1,\"Marine-terminating\"\n", "2,\"Lake-terminating\"\n", "3,\"Shelf-terminating\"\n", "9,\"Not assigned\"\n", "\"\"\")\n", "df = pd.read_csv(data, sep=\",\", index_col=0)\n", "df" ] }, { "cell_type": "code", "execution_count": 11, "id": "d22f0655-b818-437f-bfb4-c12bc2a477e1", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "| Value | Terminus type |\n", "|--------:|:-------------------|\n", "| 0 | Land-terminating |\n", "| 1 | Marine-terminating |\n", "| 2 | Lake-terminating |\n", "| 3 | Shelf-terminating |\n", "| 9 | Not assigned |\n" ] } ], "source": [ "print(df.to_markdown())" ] }, { "cell_type": "code", "execution_count": 12, "id": "6ded3f4c-ed11-4d53-8eef-2712bf889fe2", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Aspect sectorAspect range
Value
1North[-22.°; 22.5°]
2North-east[22.5°; 67.5°]
3East[67.5°; 112.5°]
4South-east[112.5°; 157.5°]
5South[157.5°; 202.5°]
6South-west[202.5; 247.5°]
7West[247.5°; 292.5°]
8North-west[292.5°; 337.5°]
9Not assigned
\n", "
" ], "text/plain": [ " Aspect sector Aspect range\n", "Value \n", "1 North [-22.°; 22.5°]\n", "2 North-east [22.5°; 67.5°]\n", "3 East [67.5°; 112.5°]\n", "4 South-east [112.5°; 157.5°]\n", "5 South [157.5°; 202.5°]\n", "6 South-west [202.5; 247.5°]\n", "7 West [247.5°; 292.5°]\n", "8 North-west [292.5°; 337.5°]\n", "9 Not assigned " ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data = StringIO(\"\"\"Value,Aspect sector,Aspect range\n", "1,\"North\",\"[-22.°; 22.5°]\"\n", "2,\"North-east\",\"[22.5°; 67.5°]\"\n", "3,\"East\",\"[67.5°; 112.5°]\"\n", "4,\"South-east\",\"[112.5°; 157.5°]\"\n", "5,\"South\",\"[157.5°; 202.5°]\"\n", "6,\"South-west\",\"[202.5; 247.5°]\"\n", "7,\"West\",\"[247.5°; 292.5°]\"\n", "8,\"North-west\",\"[292.5°; 337.5°]\"\n", "9,\"Not assigned\",\" \"\n", "\"\"\")\n", "df = pd.read_csv(data, sep=\",\", index_col=0)\n", "df" ] }, { "cell_type": "code", "execution_count": 13, "id": "a1457a0c-a526-403c-bf01-a6b4cf5dc078", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "| Value | Aspect sector | Aspect range |\n", "|--------:|:----------------|:-----------------|\n", "| 1 | North | [-22.°; 22.5°] |\n", "| 2 | North-east | [22.5°; 67.5°] |\n", "| 3 | East | [67.5°; 112.5°] |\n", "| 4 | South-east | [112.5°; 157.5°] |\n", "| 5 | South | [157.5°; 202.5°] |\n", "| 6 | South-west | [202.5; 247.5°] |\n", "| 7 | West | [247.5°; 292.5°] |\n", "| 8 | North-west | [292.5°; 337.5°] |\n", "| 9 | Not assigned | |\n" ] } ], "source": [ "print(df.to_markdown())" ] }, { "cell_type": "markdown", "id": "d03c1d73-a62d-454a-b513-514872b3f02e", "metadata": {}, "source": [ "### Intersects product " ] }, { "cell_type": "code", "execution_count": 14, "id": "e4ed2d42-6005-434b-b7ee-9c48fe5c90a1", "metadata": {}, "outputs": [], "source": [ "attrs = {\n", " 'rgi_id': {\n", " 'long_name': 'RGI identifier',\n", " 'description': 'Unique identifier assigned to a single intersect line.',\n", " 'datatype': 'str',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", " 'rgi_g_id_1': {\n", " 'long_name': 'RGI glacier identifier of glacier 1',\n", " 'description': 'Glacier identifier of the intersected glacier number 1. An intersect line is always connecting two glaciers, but the choice of which glacier is listed as 1 is arbitrary.',\n", " 'datatype': 'str',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", " 'rgi_g_id_2': {\n", " 'long_name': 'RGI glacier identifier of glacier 2',\n", " 'description': 'Glacier identifier of the intersected glacier number 2. An intersect line is always connecting two glaciers, but the choice of which glacier is listed as 2 is arbitrary.',\n", " 'datatype': 'str',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", " 'length_m': {\n", " 'long_name': 'Intersect length',\n", " 'description': 'Length of the intersect in meters.',\n", " 'datatype': 'float',\n", " 'units': 'm',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", " 'geometry': {\n", " 'long_name': 'Geometry',\n", " 'description': 'Intersect geometry (LineString).',\n", " 'datatype': '',\n", " 'units': 'deg',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", "}" ] }, { "cell_type": "code", "execution_count": 15, "id": "3e0f38a7-5c43-40e4-993f-709bd2d55ad6", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "`rgi_id`\n", ": `long_name`: RGI identifier
`description`: Unique identifier assigned to a single intersect line.
`datatype`: str
`units`:
`source`: RGI\n", "\n", "`rgi_g_id_1`\n", ": `long_name`: RGI glacier identifier of glacier 1
`description`: Glacier identifier of the intersected glacier number 1. An intersect line is always connecting two glaciers, but the choice of which glacier is listed as 1 is arbitrary.
`datatype`: str
`units`:
`source`: RGI\n", "\n", "`rgi_g_id_2`\n", ": `long_name`: RGI glacier identifier of glacier 2
`description`: Glacier identifier of the intersected glacier number 2. An intersect line is always connecting two glaciers, but the choice of which glacier is listed as 2 is arbitrary.
`datatype`: str
`units`:
`source`: RGI\n", "\n", "`length_m`\n", ": `long_name`: Intersect length
`description`: Length of the intersect in meters.
`datatype`: float
`units`: m
`source`: RGI\n", "\n", "`geometry`\n", ": `long_name`: Geometry
`description`: Intersect geometry (LineString).
`datatype`:
`units`: deg
`source`: RGI\n", "\n" ] } ], "source": [ "for k, v in attrs.items():\n", " print(f'`{k}`')\n", " first = True\n", " for ik, iv in v.items():\n", " if first:\n", " print(f': `{ik}`: {iv}', end='')\n", " first = False\n", " elif 'rgi6_name' not in ik:\n", " print(f'
`{ik}`: {iv}', end='')\n", " print(f'')\n", " print(f'')" ] }, { "cell_type": "code", "execution_count": 16, "id": "1a813440-97fd-4c11-be29-ca53587bf6ec", "metadata": {}, "outputs": [], "source": [ "with open('rgi7_intersects_attributes_metadata.json', 'w') as outfile:\n", " json.dump(attrs, outfile, indent=2)" ] }, { "cell_type": "markdown", "id": "b3dac009-8ccd-44ce-a706-57847a525a7c", "metadata": {}, "source": [ "### Merged product " ] }, { "cell_type": "code", "execution_count": 17, "id": "30deb190-d9b2-4040-9b89-70c14d0db22f", "metadata": {}, "outputs": [], "source": [ "attrs = {\n", " 'rgi_id': {\n", " 'long_name': 'RGI identifier',\n", " 'description': 'Unique identifier assigned to a single glacier complex.',\n", " 'datatype': 'str',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", " 'o1region': {\n", " 'long_name': 'First order region',\n", " 'description': 'The code of the first-order region to which the glacier belongs.',\n", " 'datatype': 'str',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'O1Region',\n", " },\n", " 'o2region': {\n", " 'long_name': 'Second order region',\n", " 'description': 'The code of the second-order region to which the glacier belongs.',\n", " 'datatype': 'str',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'O2Region',\n", " },\n", " 'cenlon': {\n", " 'long_name': 'Center longitude',\n", " 'description': 'Longitude of an approximately central point within the glacier outlines (not the centroid).',\n", " 'datatype': 'float',\n", " 'units': 'degrees',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'CenLon',\n", " }, \n", " 'cenlat': {\n", " 'long_name': 'Center latitude',\n", " 'description': 'Latitude of an approximately central point within the glacier outlines (not the centroid).',\n", " 'datatype': 'float',\n", " 'units': 'degrees',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'CenLat',\n", " }, \n", " 'utm_zone': {\n", " 'long_name': 'UTM zone',\n", " 'description': 'Number of the UTM zone for this glacier complex, based on its representative point. Note that this attribute is for information only, the geometries are all in WGS84.',\n", " 'datatype': 'int',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " }, \n", " 'area_km2': {\n", " 'long_name': 'Glacier complex area',\n", " 'description': 'Area of the glacier complex.',\n", " 'datatype': 'float',\n", " 'units': 'km2',\n", " 'source': 'RGI',\n", " 'rgi6_name': 'Area',\n", " }, \n", " 'geometry': {\n", " 'long_name': 'Geometry',\n", " 'description': 'Glacier complex geometry (Polygon).',\n", " 'datatype': '',\n", " 'units': 'deg',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", "}" ] }, { "cell_type": "code", "execution_count": 18, "id": "c29441bb-3cb7-4fc7-806c-df9e647fe593", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "`rgi_id`\n", ": `long_name`: RGI identifier
`description`: Unique identifier assigned to a single glacier complex.
`datatype`: str
`units`:
`source`: RGI\n", "\n", "`o1region`\n", ": `long_name`: First order region
`description`: The code of the first-order region to which the glacier belongs.
`datatype`: str
`units`:
`source`: RGI\n", "\n", "`o2region`\n", ": `long_name`: Second order region
`description`: The code of the second-order region to which the glacier belongs.
`datatype`: str
`units`:
`source`: RGI\n", "\n", "`cenlon`\n", ": `long_name`: Center longitude
`description`: Longitude of an approximately central point within the glacier outlines (not the centroid).
`datatype`: float
`units`: degrees
`source`: RGI\n", "\n", "`cenlat`\n", ": `long_name`: Center latitude
`description`: Latitude of an approximately central point within the glacier outlines (not the centroid).
`datatype`: float
`units`: degrees
`source`: RGI\n", "\n", "`utm_zone`\n", ": `long_name`: UTM zone
`description`: Number of the UTM zone for this glacier complex, based on its representative point. Note that this attribute is for information only, the geometries are all in WGS84.
`datatype`: int
`units`:
`source`: RGI\n", "\n", "`area_km2`\n", ": `long_name`: Glacier complex area
`description`: Area of the glacier complex.
`datatype`: float
`units`: km2
`source`: RGI\n", "\n", "`geometry`\n", ": `long_name`: Geometry
`description`: Glacier complex geometry (Polygon).
`datatype`:
`units`: deg
`source`: RGI\n", "\n" ] } ], "source": [ "for k, v in attrs.items():\n", " print(f'`{k}`')\n", " first = True\n", " for ik, iv in v.items():\n", " if first:\n", " print(f': `{ik}`: {iv}', end='')\n", " first = False\n", " elif 'rgi6_name' not in ik:\n", " print(f'
`{ik}`: {iv}', end='')\n", " print(f'')\n", " print(f'')" ] }, { "cell_type": "code", "execution_count": 19, "id": "d19b7040-e403-49ff-aa84-62d8ded5ff37", "metadata": {}, "outputs": [], "source": [ "with open('rgi7_complex_attributes_metadata.json', 'w') as outfile:\n", " json.dump(attrs, outfile, indent=2)" ] }, { "cell_type": "markdown", "id": "bc0b058e-a4b5-4593-a2b4-436fb0a503dd", "metadata": {}, "source": [ "### Centerlines product " ] }, { "cell_type": "code", "execution_count": 20, "id": "6f9ef424-8ca0-41a7-a9c9-c6650a9ddafb", "metadata": {}, "outputs": [], "source": [ "attrs = {\n", " 'rgi_id': {\n", " 'long_name': 'RGI identifier',\n", " 'description': 'Unique identifier assigned to a single intersect line.',\n", " 'datatype': 'str',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", " 'rgi_g_id': {\n", " 'long_name': 'RGI glacier identifier',\n", " 'description': 'Glacier ID to which the centerline belongs.',\n", " 'datatype': 'str',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", " 'segment_id': {\n", " 'long_name': 'Segment identifier',\n", " 'description': 'Integer number uniquely identifying this centerline within the glacier. The main centerline is always last.',\n", " 'datatype': 'int',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", " 'is_main': {\n", " 'long_name': 'Is main centerline',\n", " 'description': 'Integer number indicating whether the centerline in the main centerline (1) or not (0). There is only one main centerline per glacier.',\n", " 'datatype': 'int',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", " 'outflow_id': {\n", " 'long_name': 'Outflow segment identifier',\n", " 'description': 'Each secondary centerline flows into another centerline. This identifier points to the `segment_id` to which this centerline flows to.',\n", " 'datatype': 'int',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", " 'strahler_n': {\n", " 'long_name': 'Strahler number of this centerline.',\n", " 'description': 'Strahler number (hydrological order) of the centerline, from lowest (1, line without tributaries but with possible descendants) to highest (the main centerline).',\n", " 'datatype': 'int',\n", " 'units': '',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", " 'length_m': {\n", " 'long_name': 'Centerline length',\n", " 'description': 'Length of the centerline in meters.',\n", " 'datatype': 'int',\n", " 'units': 'm',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", " 'geometry': {\n", " 'long_name': 'Geometry',\n", " 'description': 'Centerline geometry (LineString).',\n", " 'datatype': '',\n", " 'units': 'deg',\n", " 'source': 'RGI',\n", " 'rgi6_name': '',\n", " },\n", "}" ] }, { "cell_type": "code", "execution_count": 21, "id": "10178603-362b-4d4f-8cf0-889a368f585a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "`rgi_id`\n", ": `long_name`: RGI identifier
`description`: Unique identifier assigned to a single intersect line.
`datatype`: str
`units`:
`source`: RGI\n", "\n", "`rgi_g_id`\n", ": `long_name`: RGI glacier identifier
`description`: Glacier ID to which the centerline belongs.
`datatype`: str
`units`:
`source`: RGI\n", "\n", "`segment_id`\n", ": `long_name`: Segment identifier
`description`: Integer number uniquely identifying this centerline within the glacier. The main centerline is always last.
`datatype`: int
`units`:
`source`: RGI\n", "\n", "`is_main`\n", ": `long_name`: Is main centerline
`description`: Integer number indicating whether the centerline in the main centerline (1) or not (0). There is only one main centerline per glacier.
`datatype`: int
`units`:
`source`: RGI\n", "\n", "`outflow_id`\n", ": `long_name`: Outflow segment identifier
`description`: Each secondary centerline flows into another centerline. This identifier points to the `segment_id` to which this centerline flows to.
`datatype`: int
`units`:
`source`: RGI\n", "\n", "`strahler_n`\n", ": `long_name`: Strahler number of this centerline.
`description`: Strahler number (hydrological order) of the centerline, from lowest (1, line without tributaries but with possible descendants) to highest (the main centerline).
`datatype`: int
`units`:
`source`: RGI\n", "\n", "`length_m`\n", ": `long_name`: Centerline length
`description`: Length of the centerline in meters.
`datatype`: int
`units`: m
`source`: RGI\n", "\n", "`geometry`\n", ": `long_name`: Geometry
`description`: Centerline geometry (LineString).
`datatype`:
`units`: deg
`source`: RGI\n", "\n" ] } ], "source": [ "for k, v in attrs.items():\n", " assert len(k) <= 10\n", " print(f'`{k}`')\n", " first = True\n", " for ik, iv in v.items():\n", " if first:\n", " print(f': `{ik}`: {iv}', end='')\n", " first = False\n", " elif 'rgi6_name' not in ik:\n", " print(f'
`{ik}`: {iv}', end='')\n", " print(f'')\n", " print(f'')" ] }, { "cell_type": "code", "execution_count": 22, "id": "96338eae-1d2a-47b9-bcb7-2b5f455cee6e", "metadata": {}, "outputs": [], "source": [ "with open('rgi7_centerline_attributes_metadata.json', 'w') as outfile:\n", " json.dump(attrs, outfile, indent=2)" ] }, { "cell_type": "code", "execution_count": null, "id": "ea036686-1aaf-40aa-829f-b0c35f3af8f2", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.8" } }, "nbformat": 4, "nbformat_minor": 5 }