hypertidy / ncmeta

Tidy NetCDF metadata
https://hypertidy.github.io/ncmeta/
11 stars 5 forks source link

handle files with no *recognized* variables #3

Closed mdsumner closed 7 years ago

mdsumner commented 7 years ago

ncdf4 and RNetCDF can't deal with this file

l3_file
#[1]"/rdsi/PRIVATE/raad/data/oceandata.sci.gsfc.nasa.gov/MODISA/L3BIN/2002/184/A2002184.L3b_DAY_RRS.nc"
 tidync(l3_file)
  Evaluation error: Column `id`: not found in data. 

allow tidync to report the absence of any dimensions or variables.

RNetCDF gives a nice summary of what it does see:

RNetCDF::print.nc(RNetCDF::open.nc(l3_file))
// global attributes:
                :product_name = "A2002184.L3b_DAY_RRS.nc" ;
                :title = "MODIS Level-3 Binned Data" ;
                :instrument = "MODIS" ;
                :platform = "Aqua" ;
                :temporal_range = "2-hour" ;
                :start_orbit_number = 885 ;
                :end_orbit_number = 886 ;
                :date_created = "2015-06-23T00:21:36.000Z" ;
                :processing_version = "2014.0" ;
                :history = "l2bin par=A2002184.L3b_DAY_RRS.param" ;
                :time_coverage_start = "2002-07-04T00:40:05.000Z" ;
                :time_coverage_end = "2002-07-04T02:35:05.000Z" ;
                :northernmost_latitude = 70.97916 ;
                :southernmost_latitude = -43.52083 ;
                :easternmost_longitude = -154.5415 ;
                :westernmost_longitude = -179.9792 ;
                :geospatial_lat_max = 70.97916 ;
                :geospatial_lat_min = -43.52083 ;
                :geospatial_lon_max = -154.5415 ;
                :geospatial_lon_min = -179.9792 ;
                :geospatial_lat_units = "degrees_north" ;
                :geospatial_lon_units = "degrees_east" ;
                :geospatial_lon_resolution = 0.04166667 ;
                :geospatial_lat_resolution = 0.04166667 ;
                :spatialResolution = "4.6 km" ;
                :data_bins = 154831 ;
                :percent_data_bins = 0.6515996 ;
                :units = "angstrom:,aot_869:,Rrs_412:sr^-1,Rrs_443:sr^-1,Rrs_469:sr^-1,Rrs_488:sr^-1,Rrs_531:sr^-1,Rrs_547:sr^-1,Rrs_555:sr^-1,Rrs_645:sr^-1,Rrs_667:sr^-1,Rrs_678:sr^-1" ;
                :binning_scheme = "Integerized Sinusoidal Grid" ;
                :project = "Ocean Biology Processing Group (NASA/GSFC/OBPG)" ;
                :institution = "NASA Goddard Space Flight Center, Ocean Ecology Laboratory, Ocean Biology Processing Group" ;
                :standard_name_vocabulary = "NetCDF Climate and Forecast (CF) Metadata Conventions" ;
                :Metadata_Conventions = "Unidata Dataset Discovery v1.0" ;
                :Conventions = "CF-1.6, Unidata Dataset Discovery v1.0" ;
                :naming_authority = "gov.nasa.gsfc.sci.oceandata" ;
                :id = "A2002184.L3b_DAY_RRS.nc/L3/A2002184.L3b_DAY_RRS.nc" ;
                :license = "http://science.nasa.gov/earth-science/earth-science-data/data-information-policy/" ;
                :creator_name = "NASA/GSFC/OBPG" ;
                :publisher_name = "NASA/GSFC/OBPG" ;
                :creator_email = "data@oceancolor.gsfc.nasa.gov" ;
                :publisher_email = "data@oceancolor.gsfc.nasa.gov" ;
                :creator_url = "http://oceandata.sci.gsfc.nasa.gov" ;
                :publisher_url = "http://oceandata.sci.gsfc.nasa.gov" ;
                :processing_level = "L3 Binned" ;
                :cdm_data_type = "point" ;
                :identifier_product_doi_authority = "http://dx.doi.org" ;
                :identifier_product_doi = "10.5067/AQUA/MODIS_OC.2014.0" ;
                :keywords = "Oceans > Ocean Chemistry > Chlorophyll; Oceans > Ocean Optics > Ocean Color" ;
                :keywords_vocabulary = "NASA Global Change Master Directory (GCMD) Science Keywords" ;

ncdf4 can't touch it, making much the same assumption as tidync currently does:

ncdf4::nc_open(l3_file)
Error in ncvar_type_to_string(rv$precint) : 
  Error, unrecognized type code of variable supplied: -1
mdsumner commented 7 years ago

Better attempt here: f6350523f611bfd0af8ec449fc41754db3176f25

Need to check if no-dimensions, no-variables - what if dimensions are present, is that still ok?

mdsumner commented 7 years ago

This is working.