Project

General

Profile

'fldmean' giving 'Nanf'. Issue with dimensions definition?

Added by Valerio Lembo over 4 years ago

I am processing data from a model I did not run, and I get 'nan' when trying to compute global averages on its generic grid. Even though no specific grid is recognized, it is supposed to be a regular grid along longitudes and latitudes, so I would expect to get a non-weighted average over all the grid steps. The dataset has 'Nanf' on the extremal latitudes, but this should not be a problem, since CDO shall ignore them, but apparently it is not the case.

I tried to redefine the _FIllValue with 'setattribute' and specify the missing value with 'setmissval' but it did not help.

I am pretty sure the definition of the dimensions has some issues, because, as one of my attempts, I tried to redefine the units of measure for 'lat' with 'setattribute' but it did not work out. Do you have any hints on what might be missing?

Thanks,
Valerio

PS: please find in attachment an example of the datasets I am working with.


Replies (3)

RE: 'fldmean' giving 'Nanf'. Issue with dimensions definition? - Added by Uwe Schulzweida over 4 years ago

Use setmissval,nan or setctomiss,nan to set the NaNs to missing value. In the first case (setmissval) the missing value will be NaN and in the second case the NaNs will be changed to the missing value found in _FillValue/missing_value.

RE: 'fldmean' giving 'Nanf'. Issue with dimensions definition? - Added by Valerio Lembo over 4 years ago

Thanks, Uwe!

This chain of commands is exactly what I was looking for.

What about the definitions for the dimensions? When I try to use remapbil from generic to, say, r180x90, the error that I get is:

cdo    remapbil (Abort): Unsupported generic coordinates (Variable: hfls)!

I wonder if there is some missing attribute, or the grid is somewhat ill defined. I also tried to redefine it by using setgrid and a grid descriptor file of my own, but I still get the same error.

Thanks again for helping.
Valerio

RE: 'fldmean' giving 'Nanf'. Issue with dimensions definition? - Added by Uwe Schulzweida over 4 years ago

The units of the coordinates do not follow the NetCDF CF-convention. You have to change it to "degrees_east/degrees_north". Here is an example to change the units with the NCO tool ncatted:

ncatted -a units,lat,o,c,"degrees_north"  -a units,lon,o,c,"degrees_east"  hfls_HOT.nc

    (1-3/3)