Skip to content

Extracting lat/long and insert into geospatial bounding box fields #9331

@pdurbin

Description

@pdurbin

@atrisovic and I exchanged emails with @plesubc and he has inspired us to use GDAL, ogrinfo or similar to try extracting latitude and longitude from a NetCDF file.

As this is just a spike, some discovery, we're sizing this as 10 or 1 day.

Here's part of the email from Paul (this file happens to span the entire globe):

"Metadata extraction is a relatively simple process assuming you’re using GDAL. The GDAL suite exports file metadata to stdout, so all you really need to do is capture and process the text. Of course, differing formats have differing outputs, because life is never that simple.

So, for example, imagine you downloaded a netcdf from here:

https://data.ceda.ac.uk/badc/ukmo-hadobs/data/derived/MOHC/HadOBS/HadEX3/v3-0-2 (HadEX3-0-2_cwd_ann_1901-2018.nc). This isn’t some special data set, it’s the result of a google for spatial netcdf files.

Basically, filtering this file through ogrinfo (one of the utilities in GDAL), you get something like this as output:

ogrinfo *nc
INFO: Open of `HadEX3-0-2_cwd_ann_1901-2018.nc'
      using driver `netCDF' successful.
Metadata:
  NC_GLOBAL#acknowledgement=RJHD was supported by Met Office Hadley Centre Climate Programme funded by BEIS and Defra
  NC_GLOBAL#CDI=Climate Data Interface version 1.9.9rc1 (https://mpimet.mpg.de/cdi)
  NC_GLOBAL#cdm_data_type=grid
  NC_GLOBAL#CDO=Climate Data Operators version 1.9.9rc1 (https://mpimet.mpg.de/cdo)
  [NC_GLOBAL#creator_email=robert.dunn@metoffice.gov.uk](mailto:NC_GLOBAL#creator_email=robert.dunn@metoffice.gov.uk)
  NC_GLOBAL#creator_name=Robert Dunn
  NC_GLOBAL#creator_url=[www.metoffice.gov.uk](http://www.metoffice.gov.uk/)
  NC_GLOBAL#dataset_version=3.0.2
  NC_GLOBAL#date_created=Mon Oct 26, 12:10 2020
  NC_GLOBAL#DOI=https://doi.org/10.1029/2019JD032263
  NC_GLOBAL#geospatial_lat_max=90
  NC_GLOBAL#geospatial_lat_min=-90
  NC_GLOBAL#geospatial_lat_resolution=1.25
  NC_GLOBAL#geospatial_lat_units=degrees
  NC_GLOBAL#geospatial_lon_max=360
  NC_GLOBAL#geospatial_lon_min=0
  NC_GLOBAL#geospatial_lon_resolution=1.875
  NC_GLOBAL#geospatial_lon_units=degrees
  NC_GLOBAL#institution=Met Office Hadley Centre, Exeter, UK
  NC_GLOBAL#keywords=extremes indices, gridded, temperature, precipitation, ETCCDI
  NC_GLOBAL#licence=HadEX3 is distributed under the Open Government Licence: http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/. The data are available for use with attribution to the data providers. Please cite Dunn et al (2020) and state the version used. This product may contain data which are governed by WMO Policy following WMO Resolution 40 Annex 1 alongside additional data that may have restrictions placed on their commercial use by the data owners. Any redistribution of this product should be accompanied by a similar statement of usage policy.
  NC_GLOBAL#Metadata_Conventions=Unidata Dataset Discovery v1.0,CF Discrete Sampling Geometries Conventions
  NC_GLOBAL#NCO=netCDF Operators version 4.7.5 (Homepage = http://nco.sf.net/, Code = http://github.com/nco/nco)
  NC_GLOBAL#processing_level=Daily TX, TN and P observations, converted to ETCCDI indices, and then gridded
  NC_GLOBAL#references=Dunn, Alexander et al. 2020, Journal of Geophysical Research - Atmospheres, https://doi.org/10.1029/2019JD032263
  NC_GLOBAL#source=HadEX3 data product
  NC_GLOBAL#summary=Gridded dataset of extremes indices
  NC_GLOBAL#time_coverage_end=2019-01-01T00:00Z
  NC_GLOBAL#time_coverage_resolution=Monthly
  NC_GLOBAL#time_coverage_start=1901-01-01T00:00Z
  NC_GLOBAL#title=CWD

Metadata

Metadata

Assignees

No one assigned

    Labels

    Size: 10A percentage of a sprint. 7 hours.pm.netcdf-hdf5.dAll 3 aims are currently under this deliverable

    Type

    No type

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions