markpayneatwork / ClimateOperators

An R package containing wrappers to the Climate Data Operators (CDO) and the NetCDF Operators (NCO)
GNU General Public License v3.0
27 stars 6 forks source link

Error executing some cdo operators #1

Closed PGZikalala closed 4 years ago

PGZikalala commented 4 years ago

Hiya.

I am trying to subtract a constant as follows: cdo(csl("subc",273.15), infile, outfile)

I get the following error: Warning: Some data values (min=-2291 max=-1983) are outside the valid range (0 - 65535) of the used output precision! Use the CDO option -b F32 or -b F64 to increase the output precision. Error (cdf_put_vara_double): NetCDF: Numeric conversion not representable Error in cdo(csl("subc", 273.15), infile, outfile)

Any thoughts of why this is occurring?

Thank you.

Prudentia

markpayneatwork commented 4 years ago

This looks like an issue with the format of NetCDF file that you are working with - the data appears to be represented internally in the NetCDF file as an unsigned short integer (type NC_USHORT) - you can check this using the ncdump command line utility for example

> ncdump -h <infile> CDO seems to failing gracefully here though, so try adding the flag as it suggests:

cdo("-b F32", csl("subc",273.15), infile, outfile)