-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cf: if crs
key not present, check keys like proj4
, wkt
, epsg
, esri
#736
Comments
What's in the spec? I thought the grid_mapping variable was a key that linked to a shared crs string for the whole dataset. |
Edited after reading the spec What happens if that The spec does say it's supposed to be a variable: but this particular dataset does not have that variable (though it does have a global proj4 field). It shouldn't error on load at least. |
Here's an overview of the dataset, for reference: julia> zg = zopen("reference://nwm_reanalysis.json", "r")
ZarrGroup at ReferenceStore with 2939545 references
and path
Variables: time elevation qBtmVertRunoff q_lateral qSfcLatRunoff streamflow feature_id velocity latitude qBucket order longitude
julia> zg["velocity"].attrs
Dict{String, Any} with 10 entries:
"missing_value" => -999900
"coordinates" => "longitude latitude"
"units" => "m s-1"
"add_offset" => 0.0
"_ARRAY_DIMENSIONS" => Any["time", "feature_id"]
"long_name" => "River Velocity"
"grid_mapping" => "crs"
"scale_factor" => 0.01
"_Netcdf4Dimid" => 0
"valid_range" => Any[0, 5000000]
julia> zg.attrs
Dict{String, Any} with 19 entries:
"TITLE" => "OUTPUT FROM WRF-Hydro v5.2.0-beta2"
"code_version" => "v5.2.0-beta2"
"stream_order_output" => 1
"proj4" => "+proj=lcc +units=m +a=6370000.0 +b=6370000.0 +lat_1=30.0 +lat_2=60.0 +lat_0=40.0 +lon_0=-97.0 +x_0=0 +y_0=0 +k_0=1.0 +…
"cdm_datatype" => "Station"
"model_initialization_time" => "1979-02-01_00:00:00"
"model_output_valid_time" => "1979-02-01_01:00:00"
"dev_channelBucket_only" => 0
"model_configuration" => "retrospective"
"featureType" => "timeSeries"
"dev_channel_only" => 0
"Conventions" => "CF-1.6"
⋮ => ⋮
julia> zg.attrs |> println
Dict{String, Any}("TITLE" => "OUTPUT FROM WRF-Hydro v5.2.0-beta2", "code_version" => "v5.2.0-beta2", "stream_order_output" => 1, "proj4" => "+proj=lcc +units=m +a=6370000.0 +b=6370000.0 +lat_1=30.0 +lat_2=60.0 +lat_0=40.0 +lon_0=-97.0 +x_0=0 +y_0=0 +k_0=1.0 +nadgrids=@", "cdm_datatype" => "Station", "model_initialization_time" => "1979-02-01_00:00:00", "model_output_valid_time" => "1979-02-01_01:00:00", "dev_channelBucket_only" => 0, "model_configuration" => "retrospective", "featureType" => "timeSeries", "dev_channel_only" => 0, "Conventions" => "CF-1.6", "model_total_valid_times" => 1416, "station_dimension" => "feature_id", "dev_NOAH_TIMESTEP" => 3600, "dev_OVRTSWCRT" => 1, "_NCProperties" => "version=2,netcdf=4.7.4,hdf5=1.10.7,", "model_output_type" => "channel_rt", "dev" => "dev_ prefix indicates development/internal meta data") and here's an overview from ZarrDatasets:
|
Hm I thought Maybe there's a convention to name them e.g. |
So I just found out that the data structure I encountered is very much not official. That being said it still works in Python so we should probably look at that. |
Yeah, there are lots of hacks to get around the netcdf CF. I'm happy to check for those keys, but would be good to see the python code that's generating them to get it right |
This is on the
cf
branch.I tried to load a raster where
grid_mapping => "crs"
, but there's nocrs
field in the dataset, only aproj4
field. It also looks like the current code tries to load a variable in the dataset? somehow? Maybe that's a typo.Ended up hacking around it by simply replacing
Rasters.jl/src/sources/commondatamodel.jl
Lines 165 to 173 in c225840
with a set of checks on possible crs strings, and it doesn't error if it can't find it, only warns.
Is this a solution that makes sense, or should we just not do it? It doesn't actually read the CRS still.
The text was updated successfully, but these errors were encountered: