Regridding from unstructured grid to regular - Unsupported array structure error
Added by Victoria Bessonova over 1 year ago
I have a dataset on unstructured grid, the printout is below, file is attached.
dimensions:
ncells = 32516 ;
month = 12 ;
variables:
float mi(ncells, month) ;
mi:_FillValue = NaNf ;
mi:grid_mapping = "latitude_longitude" ;
mi:coordinates = "lat lon" ;
int latitude_longitude ;
latitude_longitude:grid_mapping_name = "latitude_longitude" ;
latitude_longitude:longitude_of_prime_meridian = 0. ;
latitude_longitude:earth_radius = 6371229. ;
int64 ncells(ncells) ;
int64 month(month) ;
float lat(ncells) ;
lat:_FillValue = NaNf ;
lat:standard_name = "latitude" ;
lat:units = "degrees_north" ;
float lon(ncells) ;
lon:_FillValue = NaNf ;
lon:standard_name = "longitude" ;
lon:units = "degrees_east" ;
I am trying to regrid it to a r360x180 grid using cdo but even printing out the info using sinfon crs_test_v1.nc fails:
Warning (cdf_read_xcoord): Unsupported array structure, skipped variable mi!
Warning (cdfInqContents): No data arrays found!
cdo sinfon: Open failed on >crs_test_v1.nc<
Unsupported file structure
I tried to split the ncells dimension into lat/lon in python and then regrid. That works but then the result doesn't look like regular grid when plotting (see attached image). I am not a regular user of cdo so any advice would be greatly appreciated.
regridded.jpg (57 KB) regridded.jpg | results of regridding if the ncells dimension is unstacked | ||
crs_test_v1.nc (1.99 MB) crs_test_v1.nc | Dataset to convert to regular grid |
Replies (8)
RE: Regridding from unstructured grid to regular - Unsupported array structure error - Added by Victoria Bessonova over 1 year ago
UPDATE:
Changing the environment variable IGNORE_ATT_COORDINATES from 0 to 1 allowed for the file to be readable by sinfon, however when I try to regrid using "remapdis,r360x180 crs_test_v1.nc output.nc" or the same but with remapnn, I get the error: Unsupported projection coordinates (Variable:mi)
Help is still needed, please!
RE: Regridding from unstructured grid to regular - Unsupported array structure error - Added by Ralf Mueller over 1 year ago
Hi Victoria!
in order to let CDO work with your input, the dimension of the data variable mi
need to be re-ordered. this is possible with NCO:
ncpdq --rdr time,ncells crs_test_v1.nc -v mi -o output.nc
Next is the deletion of the data variable ncells
:
ncks -C -x -v ncells output.nc -o cleaned_output.nc
then you can interpolate with something like:
cdo -L -remapnn,global_1 -selname,mi cleaned_output.nc nn_output.nc
Please note, that your data is on an unstructured grid, so bilinear interpolation is not possible. Since there are no bounds for the lon lat coordinates, conservative remapping does not work, too.
hth
ralf
RE: Regridding from unstructured grid to regular - Unsupported array structure error - Added by Victoria Bessonova over 1 year ago
Hello Ralf,
Thanks for the reply. I just tried what you've suggested and the error persists.
RE: Regridding from unstructured grid to regular - Unsupported array structure error - Added by Ralf Mueller over 1 year ago
Victoria Bessonova wrote in RE: Regridding from unstructured grid to regular - Unsupp...:
Hello Ralf,
Thanks for the reply. I just tried what you've suggested and the error persists.
which of the commands did not work? everything but the last?
RE: Regridding from unstructured grid to regular - Unsupported array structure error - Added by Victoria Bessonova over 1 year ago
First two lines worked, the last one didn't:
cdo(1) selname: Process started
cdo remapnn (Abort): Unsupported projection coordinates (Variable: mi)!
terminate called without an active exception
Aborted
RE: Regridding from unstructured grid to regular - Unsupported array structure error - Added by Ralf Mueller over 1 year ago
weird - for me it works out fine. I use the latest cdo release. lets compare the cleaned_output.nc
. I upload mine as cleaned_output_ram.nc
cleaned_output_ram.nc (1.74 MB) cleaned_output_ram.nc |
RE: Regridding from unstructured grid to regular - Unsupported array structure error - Added by Victoria Bessonova over 1 year ago
Hi Ralf,
It worked!!! Thank you! I updated both cdo and nco and needed to change IGNORE_ATT_COORDINATES back to 0 (and of course rename both variable and dimension "month" to "time" - previously I was only updating the dimension and missed the fact that variable disappeared after that).
I also noticed that the first line changes time values to zeros (I guess because they are not CF compliant), but that's obviously not a problem in my case - can restore it afterwards.
RE: Regridding from unstructured grid to regular - Unsupported array structure error - Added by Ralf Mueller over 1 year ago
great to hear, you finally have a solution
have a nice day!
ralf