cdo hpupgrade
Added by Niklas Röber 5 months ago
Hi, what defines a healpix grid, i.e. satisfies gridType == GRID_HEALPIX in CDO in the function is_healpix_grid? I am trying to upsample a lower resolution HPX file to a higher resolution, but fail to get cdo hpupgrade to work. I do have a correct 2D HPX netcdf file, yet I do not get this done. Any hint or working example? Thanks and Cheers, Niklas
Replies (6)
RE: cdo hpupgrade - Added by Uwe Schulzweida 5 months ago
Hi Niklas,
here is an example:
Create data on hpz6: cdo -f nc topo,hpz6 topo_hpz6.nc Upgrate to hpz7: cdo hpupgrade,nside=128 topo_hpz6.nc topo_hpz7.ncPlease upload your HPX netCDF file, as this will help us analyze the problem.
Cheers,
Uwe
RE: cdo hpupgrade - Added by Niklas Röber 5 months ago
Perfext, Uwe and Thanks a lot,
This works. The data I got was created using this:
cdo -f nc -setgridtype,unstructured -select,timestep=1,name=tas file:///fastdata/ka1081/nextgems_cycle3/ngc3028/ngc3028_P1D_8.zarr/#mode=zarr,file z8.nc
And then I tried using cdo to upgrade like this:
cdo hpupgrade,nside=512 z8.nc z9.nc
cdo hpupgrade (Abort): Input grid is not healpix!
ncdump -h shows:
netcdf z8 {
dimensions:
time = UNLIMITED ; // (1 currently)
ncells = 786432 ;
vertices = 4 ;
variables:
int time(time) ;
time:standard_name = "time" ;
time:units = "seconds since 1970-01-01" ;
time:calendar = "proleptic_gregorian" ;
time:axis = "T" ;
float lon(ncells) ;
lon:standard_name = "longitude" ;
lon:long_name = "longitude" ;
lon:units = "radian" ;
lon:bounds = "lon_bnds" ;
float lon_bnds(ncells, vertices) ;
float lat(ncells) ;
lat:standard_name = "latitude" ;
lat:long_name = "latitude" ;
lat:units = "radian" ;
lat:bounds = "lat_bnds" ;
float lat_bnds(ncells, vertices) ;
float tas(time, ncells) ;
tas:standard_name = "air_temperature" ;
tas:long_name = "temperature in 2m" ;
tas:units = "K" ;
tas:CDI_grid_type = "unstructured" ;
tas:coordinates = "lat lon" ;
tas:cell_methods = "time: mean cell: mean" ;
tas:component = "atmo" ;
tas:vgrid = "height_2m" ;
Thanks and Cheers, Niklas
RE: cdo hpupgrade - Added by Uwe Schulzweida 5 months ago
Ok, "-setgridtype,unstructured" will convert the healpix to unstructured data. Try:
cdo -f nc -select,timestep=1,name=tas file:///fastdata/ka1081/nextgems_cycle3/ngc3028/ngc3028_P1D_8.zarr/#mode=zarr,file z8.nc cdo hpupgrade,nside=512 z8.nc z9.nc
RE: cdo hpupgrade - Added by Niklas Röber 5 months ago
Thanks Uwe, that makes sense. Is there a way to also have the cell coordinates, to properly reconstruct and position the grid for visualization? That was the beauty with using unstructured. I can of course write something to generate this, but maybe I am not the first one with this need.
Thanks and Cheers, Niklas
RE: cdo hpupgrade - Added by Uwe Schulzweida 5 months ago
Yes, you can allways create the coordinates with "-setgridtype,unstructured" if needed:
cdo -setgridtype,unstructured -hpupgrade,nside=512 z8.nc z9.nc
RE: cdo hpupgrade - Added by Niklas Röber 5 months ago
Damns, that's too simple. ;-)
I managed to write a script that computes the coordinates for me, but yours is way more elegant. Thanks. I'll be quiet now. 