{ "cells": [ { "cell_type": "markdown", "id": "6f24ffe7", "metadata": {}, "source": [ "# Get full metadata from CSV file - BEDMAP\n", "\n", "This notebook shows how to get the rich and complete metadata from the Bedmap CSV file. It also shows how to convert the CSV file to NCCSV (NetCDF compatible CSV) as an example to the FAIR implementation of the CSV format used for Bedmap.\n", "\n", "With only access to the CSV file, it is possible to programmatically obtain rich metadata from the file without having a complex metadata structure as header information in the file. \n", "\n", "## The data\n", "\n", "The BEDMAP CSV files are available for downmoad from the UK Polar data Centre:\n", "\n", "* BEDMAP1 CSV: https://doi.org/10.5285/f64815ec-4077-4432-9f55-0ce230f46029\n", "\n", "* BEDMAP2 CSV: https://doi.org/10.5285/2fd95199-365e-4da1-ae26-3b6d48b3e6ac\n", "\n", "* BEDMAP3 CSV: https://doi.org/10.5285/91523ff9-d621-46b3-87f7-ffb6efcd1847\n", " \n", "## Upload the modules\n", "\n", "For this conversion, we will need pandas, json, xarray, netCDF4 and urllib modules. \n" ] }, { "cell_type": "code", "execution_count": 1, "id": "5e329349", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import json\n", "import urllib.request\n", "import xarray\n", "import netCDF4 as nc " ] }, { "cell_type": "markdown", "id": "0c8fa192", "metadata": {}, "source": [ "## Opening and reading the CSV metadata\n", "\n", "For this exercise, we only need to check the short metadata provided in the CSV file." ] }, { "cell_type": "code", "execution_count": 2, "id": "b9d0eb00", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | 0 | \n", "1 | \n", "
---|---|---|
0 | \n", "#project | \n", "Dronning Maud Land (GEA). | \n", "
1 | \n", "#time_coverage_start | \n", "2015 | \n", "
2 | \n", "#time_coverage_end | \n", "2016 | \n", "
3 | \n", "#creator_name | \n", "Alfred Wegener Institute; Bundesanstalt für Ge... | \n", "
4 | \n", "#institution | \n", "Alfred Wegener Institute; Bundesanstalt für Ge... | \n", "
5 | \n", "#acknowledgement | \n", "Bundesanstalt für Geowissenschaften; Alfred We... | \n", "
6 | \n", "#source | \n", "https://doi.pangaea.de/10.1594/PANGAEA.915475 | \n", "
7 | \n", "#references | \n", "https://doi.org/10.1016/j.gr.2018.05.011 | \n", "
8 | \n", "#platform | \n", "airborne radar. | \n", "
9 | \n", "#instrument | \n", "AWI EMR. | \n", "
10 | \n", "#history | \n", "Incoherent processing | \n", "
11 | \n", "#electromagnetic_wave_speed_in_ice | \n", "168 (meters/microseconds) | \n", "
12 | \n", "#firn_correction | \n", "0 (m) | \n", "
13 | \n", "#centre_frequency | \n", "150 (MHz) | \n", "
14 | \n", "#comment | \n", "Part of Bedmap3 | \n", "
15 | \n", "#metadata_link | \n", "https://doi.org/10.5285/91523ff9-d621-46b3-87f... | \n", "
16 | \n", "#license | \n", "https://creativecommons.org/licenses/by/4.0/ | \n", "
17 | \n", "#Conventions | \n", "ACDD-1.3, CF-1.8 | \n", "
<xarray.Dataset>\n", "Dimensions: (index: 23382)\n", "Coordinates:\n", " * index (index) int64 0 1 2 3 ... 23378 23379 23380 23381\n", "Data variables:\n", " trajectory_id (index) object '20162002_01' ... '20162020_04'\n", " trace_number (index) int64 -9999 -9999 -9999 ... -9999 -9999\n", " longitude (degree_east) (index) float64 -5.795 -5.794 ... -7.318 -7.323\n", " latitude (degree_north) (index) float64 -71.03 -71.03 ... -70.66 -70.66\n", " date (index) object '2015-12-15' ... '2016-01-03'\n", " time_UTC (index) object '12:43:36' ... '14:51:38'\n", " surface_altitude (m) (index) int64 -9999 -9999 -9999 ... -9999 -9999\n", " land_ice_thickness (m) (index) float64 463.7 463.7 456.3 ... 252.5 253.0\n", " bedrock_altitude (m) (index) int64 -9999 -9999 -9999 ... -9999 -9999\n", " two_way_travel_time (m) (index) float64 5.52e-06 5.52e-06 ... 3.012e-06\n", " aircraft_altitude (m) (index) int64 -9999 -9999 -9999 ... -9999 -9999\n", " along_track_distance (m) (index) int64 0 56 325 ... 161406 161636 161832\n", "Attributes: (12/27)\n", " project: Dronning Maud Land (GEA).\n", " time_coverage_start: 2015\n", " time_coverage_end: 2016\n", " creator_name: Alfred Wegener Institute; Bundesansta...\n", " institution: Alfred Wegener Institute; Bundesansta...\n", " acknowledgement: National Capability - Polar Expertise...\n", " ... ...\n", " geospatial_lat_min: -90\n", " geospatial_lat_max: -60\n", " geospatial_lon_min: -180\n", " geospatial_lon_max: 180\n", " date_created: 2022-02-28\n", " keywords: Antarctica, BEDMAP, Elevation, Ice th...