attribute "coordinates" lost
Added by Jay Su over 6 years ago
I am using CDO to subset IMERG data:
cdo -s -L -f nc4 -sellonlatbox,10.0,20.0,10.0,20.0 -selname,precipitationCal 3B-DAY-E.MS.MRG.3IMERG.20170501-S000000-E235959.V04.nc4 tmp.nc4
The attribute "coordinates" is removed for all variables. May I ask why and how I can fix it?
Thanks,
Replies (5)
RE: attribute "coordinates" lost - Added by Karin Meier-Fleischer over 6 years ago
Hi Jay,
I don't have IMERG data, so is it possible to upload the data?
-Karin
RE: attribute "coordinates" lost - Added by Jay Su over 6 years ago
Uploaded. Thank you Karin.
-- Jay
RE: attribute "coordinates" lost - Added by Karin Meier-Fleischer over 6 years ago
I think the problem is that the coordinates attribute is of type NC_STRING and not NC_CHAR which violates the CF convention.
But you can add the coordinates using the setattributes operator:
cdo -setattribute,precipitationCal@coordinates="lat lon" tmp.nc4 tmp_with_coordinates.nc4
-Karin
RE: attribute "coordinates" lost - Added by Jay Su over 6 years ago
Thank you Karin,
So we are expecting coordinates to be NC_CHAR, right? I could not find it in the CF convention v1.7 though ...
By cdo -setattribute,precipitationCal@coordinates="lat lon", is it now NC_CHAR, not NC_STRING?
Is it possible we can bypass the checking in CDO? It will be tedious if I have to manually set back for all the variables.
RE: attribute "coordinates" lost - Added by Ralf Mueller over 6 years ago
hi Jay!
your upload has a regular lonlat grid - the coordinates attribute is not needed for this type of grid. Thats why CDO ignores it and doesn't keep it.
if a data variable used the lon,lat
as horizontal dimensions and there are data variables with the same name, the CF-convention is fulfilled - no extra attribute needed.
hth
ralf