covjson / specification

CoverageJSON specification
https://covjson.org/spec/
45 stars 6 forks source link

Compare and contrast CoverageJSON with CF-NetCDF #60

Open jonblower opened 8 years ago

jonblower commented 8 years ago

I think it would be helpful to have a document describing the differences in approach between CovJSON and CF-NetCDF, since that community is likely to be a key user of CovJSON. This issue is just to collect ideas, which might also stimulate some discussion about CovJSON itself (or the wording of the spec). The things that spring immediately to mind are:

  1. CovJSON can define arbitrary nestings of information in object trees. NetCDF must use a flatter structure in which attributes (key-value pairs) are attached to variable objects (or are global). This means that some "variables" in a NetCDF file are not really variables but containers for attributes, and mechanisms have to be invented to relate these containers to each other. In JSON the structure can be clearer. (NetCDF4 has nested Groups, but these aren't widely used in many communities and conventions for using them are not established.)
  2. A coverage in CovJSON has exactly one domain, which is written explicitly and defined independently of the values of the variables (these can even be in different documents). CF-NetCDF files specify coordinate variables (i.e. axes) that can be arbitrarily grouped and attached directly to variables. Therefore each variable in a CF-NetCDF file can reside on a different domain, and domains in a NetCDF file are linked directly to the variables.
  3. URIs are used frequently in CovJSON files to point to definitions and certain properties are defined to have URI values. In NetCDF there is no widely-used way of inserting URIs as metadata, or distinguishing them reliably from plain strings.
letmaik commented 8 years ago

I think it would be useful to do a manual CF-NetCDF to CovJSON conversion for a more complex case like MetOffice forecast data as in the IRIS sample data repository: https://github.com/SciTools/iris-sample-data/tree/master/iris_sample_data/sample_data

For example:

$ ncdump -h A1B_north_america.nc
netcdf A1B_north_america {
dimensions:
        time = UNLIMITED ; // (240 currently)
        latitude = 37 ;
        longitude = 49 ;
        bnds = 2 ;
variables:
        float air_temperature(time, latitude, longitude) ;
                air_temperature:standard_name = "air_temperature" ;
                air_temperature:units = "K" ;
                air_temperature:Model\ scenario = "A1B" ;
                air_temperature:ukmo__um_stash_source = "m01s03i236" ;
                air_temperature:source = "Data from Met Office Unified Model 6.05" ;
                air_temperature:cell_methods = "time: mean (interval: 6 hour)" ;
                air_temperature:grid_mapping = "latitude_longitude" ;
                air_temperature:coordinates = "forecast_period forecast_reference_time height" ;
        int latitude_longitude ;
                latitude_longitude:grid_mapping_name = "latitude_longitude" ;
                latitude_longitude:longitude_of_prime_meridian = 0. ;
                latitude_longitude:semi_major_axis = 6371229. ;
                latitude_longitude:semi_minor_axis = 6371229. ;
        double time(time) ;
                time:axis = "T" ;
                time:bounds = "time_bnds" ;
                time:units = "hours since 1970-01-01 00:00:00" ;
                time:standard_name = "time" ;
                time:calendar = "360_day" ;
        double time_bnds(time, bnds) ;
        float latitude(latitude) ;
                latitude:axis = "Y" ;
                latitude:units = "degrees_north" ;
                latitude:standard_name = "latitude" ;
        float longitude(longitude) ;
                longitude:axis = "X" ;
                longitude:units = "degrees_east" ;
                longitude:standard_name = "longitude" ;
        int forecast_period(time) ;
                forecast_period:units = "hours" ;
                forecast_period:standard_name = "forecast_period" ;
        double forecast_reference_time ;
                forecast_reference_time:units = "hours since 1970-01-01 00:00:00" ;
                forecast_reference_time:standard_name = "forecast_reference_time" ;
                forecast_reference_time:calendar = "360_day" ;
        double height ;
                height:units = "m" ;
                height:standard_name = "height" ;
                height:positive = "up" ;

// global attributes:
                :Conventions = "CF-1.5" ;
}

So the interesting parts here would be two time axes, one with bounds, a weird calendar, and a spherical earth. Probably a thing for the cookbook.

jonblower commented 8 years ago

Yes, that would be a really nice example to be able to show.