sp2gp: "No spectral data found!"
Added by Sylvia Frèrebeau 5 months ago
I used cdo in order to transform spectral components of the divergence (from div.spec.2025.nc by NOAA) to the divergence field at each longitude and latitude (sp2gp operator). It works, but it transforms each present field independently (div, scale_factor, add_offset and mean). I guess that “div” in the original file doesn’t contain the spectral components of the divergence, that these coefficients are rather given by div*scale_factor+add_offset. With GrADS, I built a new variable, divtot= div*scale_factor+add_offset and I wrote it in a new Netcdf file (with the sdfwrite command). Then I applied "cdo sp2gp", and this time it didn’t work (cdo indicated “Warning: No spectral data found!”) Why doesn’t cdo recognize a spectral grid? Which information is missing (metadata?) so that the work can be done? I thank you for your answer.
PS: "cdo sinfo [my_netcdffile]" gives:
Grid coordinates :
1 : lonlat : points=225792 (4032x56)
lon : 0 to 10077.5 by 2.5 degrees_east
lat : -90 to 47.5 by 2.5 degrees_north
instead of: "cdo sinfo [original_netcdffile]":
Grid coordinates :
1 : generic : points=1
2 : spectral : points=4032 nsp=2016 truncation=62 complexPacking
3 : generic : points=56
How can I change that? Even with "cdo setgrid" I don't find how to change the metadata for the horizontal grid.
Replies (1)
RE: sp2gp: "No spectral data found!" - Added by Uwe Schulzweida 5 months ago
Spectral coefficients are not defined in the NetCDF CF standard. Therefore, CDO uses its own standard here. For spectral coefficients, the attribute CDI_grid_type="spectral" must be present and the data must have two dimensions (2*NSP with NSP=number of spectral coefficients).
Here an example:
dimensions:
time = UNLIMITED ; // (1 currently)
nc2 = 2 ;
nsp = 2016 ;
variables:
float var(time, nsp, nc2) ;
var:CDI_grid_type = "spectral" ;