Remap Error: Generic Coordinates not supported
Added by Shreya Trivedi about 2 years ago
Hi,
I am trying to regrid the reanalysis data for the Antarctic sea-ice from GIOMAS. I have used cdo for regridding (using remapbil) several datasets in the past and it never gave me any major problems. However this time I am getting the following error:
cdo remapbil (Abort): Unsupported generic coordinates (Variable: lon_scaler)!
I have tried fixing it using the following commands but I get the same error:
"ncatted -a coordinates,lon_scaler,c,c,"lon lat" GIOMAS_heff_1979.nc test.nc"
Error message:
Warning (cdfScanVarAttr): NetCDF: Variable not found - >lon<
Warning (cdfScanVarAttr): NetCDF: Variable not found - >lat<
cdo remapbil (Abort): Unsupported generic coordinates (Variable: lon_scaler)!
I also tried following:
"cdo griddes infile.nc > mygrid
set -i "s/generic/lonlat/g" mygrid
Then use CDO to set the grid:
cdo setgrid,mygrid infile.nc infile_fixedgrid.nc"
AND
cdo setattribute,lon_scaler@coordinates="lat lon",lat_scaler@coordinates="lat lon", heff@coordinates="lat lon" GIOMAS_heff_1979.nc test.nc
I got no success here as well!
I am attaching the file for your kind perusal.
Can you please help me to solve this problem?
Any help will be appreciated.
Thanks!
Best,
Shreya
GIOMAS_heff_1979.nc (6.26 MB) GIOMAS_heff_1979.nc |
Replies (18)
RE: Remap Error: Generic Coordinates not supported - Added by Ralf Mueller about 2 years ago
hey!
Try this one
cdo -setattribute,heff@coordinates="lat_scaler lon_scaler",kmt@coordinates="lat_scaler lon_scaler",dxt@coordinates="lat_scaler lon_scaler",dyt@coordinates="lat_scaler lon_scaler" GIOMAS_heff_1979.nc t.nc
you file is not CF-conform. so CDO as problems with linking data and grid. Probably you need to fix the missing values, too.
possibly something like this
cdo -setattribute,heff@coordinates="lat_scaler lon_scaler",kmt@coordinates="lat_scaler lon_scaler",dxt@coordinates="lat_scaler lon_scaler",dyt@coordinates="lat_scaler lon_scaler,heff@missing_value=9999.9,kmt@missing_value=0" GIOMAS_heff_1979.nc t_fixMissing.nc
hth
ralf
RE: Remap Error: Generic Coordinates not supported - Added by Shreya Trivedi about 2 years ago
Hi Ralf,
Thank you very much for a prompt reply! The solution worked like a charm!
The only tweaks I need to make was set coordinates in the same manner for two other variables (z and dz) which were throwing an error when I tried to regrid the "t_fixMissing.nc" file.
Thanks again!
Regards,
Shreya
RE: Remap Error: Generic Coordinates not supported - Added by Ralf Mueller about 2 years ago
Shreya Trivedi wrote in RE: Remap Error: Generic Coordinates not supported:
Hi Ralf,
Thank you very much for a prompt reply! The solution worked like a charm!
The only tweaks I need to make was set coordinates in the same manner for two other variables (z and dz) which were throwing an error when I tried to regrid the "t_fixMissing.nc" file.Thanks again!
Regards,
Shreya
those are pure vertical axes without any horizontal grid. for regridding just select the horizontal fields and do the remapping afterwards:
cdo -remapbil,global_1 -selname,heff,kmt t_fixMissing.nc t_remapped.nc
RE: Remap Error: Generic Coordinates not supported - Added by Shreya Trivedi about 2 years ago
Thanks a tonne, Ralf, for a detailed solution and an explanation!
It works perfectly now!
Best,
Shreya
RE: Remap Error: Generic Coordinates not supported - Added by Yijun Yang almost 2 years ago
Hi Shreya and Ralf,
I meet the same problem when I regrid the Arctic sea ice data from PIOMAS. Since PIOMAS do not provide 'nc' file, I convert the 'hiday.1979' to 'PIOMAS1979.nc' first. I failed to regrid this data, so I tried to add the coordinates and missing_value following the suggestion by Ralf:
cdo -setattribute,sithick@coordinates="clat clon",sithick@missing_value=9999.9 PIOMAS1979.nc t.nc
Then I regrid 't.nc' on the grid 'outgrid1.txt', but I still got the problem:
cdo remapbil,outgrid1.txt -selname,sithick t.nc output.nc
cdo(1) selname: Process started
Warning (cdfInqContents): Coordinates variable clat can't be assigned!
Warning (cdfInqContents): Coordinates variable clon can't be assigned!
cdo remapbil (Abort): Unsupported generic coordinates (Variable: sithick)!
terminate called without an active exception
Aborted (core dumped)
I am attaching the files for your kind perusal.
Could you please help my with this problem? Many thanks in advance for any help!
outgrid1.txt (4.27 MB) outgrid1.txt | |||
PIOMAS1979.nc (121 MB) PIOMAS1979.nc |
RE: Remap Error: Generic Coordinates not supported - Added by Shreya Trivedi almost 2 years ago
Hi Yijun,
I have faced a lot of problems before dealing with the GIOMAS dataset. It's slightly tricky to work with. I looked at your files and tried to work around the same way as I did with my files. However, I am afraid I am still getting the same errors. I thought it will be better if you could have a look at what I exactly did to my dataset to make it work. Hence, sharing my "ncdump -h" with you:
1. cdo -setreftime,1850-01-01,00:00:00,1day -settaxis,1979-01-01,00:00:00,1month -setcalendar,proleptic_gregorian GIOMAS.heff.H1979-2014.nc GIOMAS.heff.H1979-2014_TRF.nc
#Set the reference time.
2. cdo -setattribute,heff@coordinates=lat_scaler lon_scaler,kmt@coordinates=lat_scaler lon_scaler,dxt@coordinates=lat_scaler lon_scaler,z@coordinates=lat_scaler lon_scaler,dz@coordinates=lat_scaler
lon_scaler,dyt@coordinates=lat_scaler lon_scaler,heff@missing_value=9999.9,kmt@missing_value=0 GIOMAS_heff_1979-2014_TRF.nc t_fixMissing.nc
#Set missing values and add attributes to all the variables except pure vertical axes.
3. cdo remapbil,Griddes.txt t_fixMissing.nc GIOMAS_heff_1979-2014_Regridded.nc #Finally, a bilinear interpolation method for regridding based on the desired grid description
See if this helps? If not then I am sure CDO community (Ralf in my case) was super helpful and they will address your query promptly!
Shreya
RE: Remap Error: Generic Coordinates not supported - Added by Shreya Trivedi almost 2 years ago
Shreya Trivedi wrote in RE: Remap Error: Generic Coordinates not supported:
Hi Yijun,
I have faced a lot of problems before dealing with the GIOMAS dataset. It's slightly tricky to work with. I looked at your files and tried to work around the same way as I did with my files. However, I am afraid I am still getting the same errors. I thought it will be better if you could have a look at what I exactly did to my dataset to make it work. Hence, sharing my "ncdump -h" with you:
cdo -setreftime,1850-01-01,00:00:00,1day -settaxis,1979-01-01,00:00:00,1month -setcalendar,proleptic_gregorian GIOMAS.heff.H1979-2014.nc GIOMAS.heff.H1979-2014_TRF.nc
#Set the reference time.
cdo -setattribute,heff@coordinates=lat_scaler lon_scaler,kmt@coordinates=lat_scaler lon_scaler,dxt@coordinates=lat_scaler lon_scaler,z@coordinates=lat_scaler lon_scaler,dz@coordinates=lat_scaler
lon_scaler,dyt@coordinates=lat_scaler lon_scaler,heff@missing_value=9999.9,kmt@missing_value=0 GIOMAS_heff_1979-2014_TRF.nc t_fixMissing.nc
#Set missing values and add attributes to all the variables except pure vertical axes.
cdo remapbil,Griddes.txt t_fixMissing.nc GIOMAS_heff_1979-2014_Regridded.nc #Finally, a bilinear interpolation method for regridding based on the desired grid description
See if this helps? If not then I am sure CDO community (Ralf in my case) was super helpful and they will address your query promptly!
Shreya
RE: Remap Error: Generic Coordinates not supported - Added by Shreya Trivedi almost 2 years ago
Shreya Trivedi wrote in RE: Remap Error: Generic Coordinates not supported:
Shreya Trivedi wrote in RE: Remap Error: Generic Coordinates not supported:
Hi Yijun,
I have faced a lot of problems before dealing with the GIOMAS dataset. It's slightly tricky to work with. I looked at your files and tried to work around the same way as I did with my files. However, I am afraid I am still getting the same errors. I thought it will be better if you could have a look at what I exactly did to my dataset to make it work. Hence, sharing my "ncdump -h" with you:
[...]
#Set the reference time.
[...]
#Set missing values and add attributes to all the variables except pure vertical axes.
[...]
See if this helps? If not then I am sure CDO community (Ralf in my case) was super helpful and they will address your query promptly!
Shreya
RE: Remap Error: Generic Coordinates not supported - Added by Karin Meier-Fleischer almost 2 years ago
Hi Yijun,
the PIOMAS file does not have any attribute for the coordinate variables time, lat, lon.
ncdump -h PIOMAS1979.nc netcdf PIOMAS1979 { dimensions: x = 360 ; y = 120 ; t = 365 ; variables: double clat(y, x) ; double clon(y, x) ; double time(t) ; double sithick(t, y, x) ; }
You have to add these before you can remap the data.
ncatted -O -a units,clat,c,c,'degrees_north' \ -a units,clon,c,c,'degrees_east' \ -a coordinates,sithick,c,c,'clat clon' \ PIOMAS1979.nc tmp.nc
Set the time like Shreya has described.
cdo -setreftime,1850-01-01,00:00:00,1day \ -settaxis,1979-01-01,00:00:00,1month \ -setcalendar,proleptic_gregorian \ -selvar,sithick tmp.nc piomas1979_with_attributes.nc
Then you can remap the data.
cdo remapbil,outgrid1.txt piomas1979_with_attributes.nc outfile.nc
RE: Remap Error: Generic Coordinates not supported - Added by Yijun Yang almost 2 years ago
Hi Shreya and Karin
Thank you all so much for the prompt reply and detailed solution! The detailed process shared by Shreya helps me a lot and the solution from Karin works perfectly and completely solves my problem!
Thanks again for your help!
All the best,
Yijun
RE: Remap Error: Generic Coordinates not supported - Added by Suvarna Tikle over 1 year ago
Hello All,
I am also facing same problem "cdo remapbil (Abort): Unsupported generic coordinates (Variable: BC)!".
I tried to fix it with following commands as per forum suggestions-
1.cdo setattribute,BC@coordinates="lat_scaler lon_scaler" LE_Indore_BC_replace.nc LE_Indore_BC_remap1.nc "Warning (cdfScanVarAttr): NetCDF: Variable not found - >lat_scaler<"
2. ncatted -a grid_mapping,BC,d,, LE_Indore_BC_replace.nc
But I got error
Then used again solution from forum
"ncatted -O -a coordinates,BC,d,, LE_Indore_BC_remap1.nc".
But now again getting the same error "cdo remapbil (Abort): Unsupported generic coordinates (Variable: BC)!"
Ncdump of my original file is as below and I would like to remap 1km grid to 10km
.
ncdump -h LE_Indore_BC_replace.nc
netcdf LE_Indore_BC_replace {
dimensions:
lon = 214 ;
lat = 164 ;
variables:
double lon(lon) ;
lon:standard_name = "projection_x_coordinate" ;
lon:units = "m" ;
lon:axis = "X" ;
double lat(lat) ;
lat:standard_name = "projection_y_coordinate" ;
lat:units = "m" ;
lat:axis = "Y" ;
char crs ;
crs:grid_mapping_name = "latitude_longitude" ;
crs:long_name = "CRS definition" ;
crs:longitude_of_prime_meridian = 0. ;
crs:semi_major_axis = 6378137. ;
crs:inverse_flattening = 298.257223563 ;
crs:spatial_ref = "GEOGCS[\"unknown\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AXIS[\"Longitude\",EAST],AXIS[\"Latitude\",NORTH]]" ;
crs:crs_wkt = "GEOGCS[\"unknown\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AXIS[\"Longitude\",EAST],AXIS[\"Latitude\",NORTH]]" ;
crs:GeoTransform = "75.11883988975056 0.009469308696612446 0 23.80153487113431 0 -0.009469308696612446 " ;
float BC ;
BC:_FillValue = NaNf ;
BC:missing_value = NaNf ;
BC:coordinates = "lon lat"
Can any one help to resolve issue this issue.
Best,
Suvarna
RE: Remap Error: Generic Coordinates not supported - Added by Karin Meier-Fleischer over 1 year ago
Hi Survana,
without the file I can only say that the grid_mapping attribute of BC is missing. Try
cdo -setattribute,BC@grid_mapping=crs infile outfile
RE: Remap Error: Generic Coordinates not supported - Added by Suvarna Tikle over 1 year ago
Hi Karin,
Thank you.
After doing this I have used below command.
cdo remapbil,CAMS_Indore_NMVOC.nc ifile.nc ofile.nc
It is giving error
"Warning (cdfScanVarAttr): NetCDF: Variable not found - crs
cdo remapbil (Abort): Unsupported generic coordinates (Variable: BC)!". File is attached.
Best,
Suvarna
RE: Remap Error: Generic Coordinates not supported - Added by Karin Meier-Fleischer over 1 year ago
There is not enough information about the grid mapping and I was not able to write a correct grid description file. You should have more information about the grid or projection of the data.
RE: Remap Error: Generic Coordinates not supported - Added by Suvarna Tikle over 1 year ago
Hi Karin,
Projection of file is WGS1984 GCS. Original file was shapefile with WGS1984 UTM projection.Then using python, I convert it to ncfile and then following command has been used to regrid it in GCS projection.
gdalwarp -r bilinear -t_srs "+proj=lonlat +datum=WGS84 +no_defs" NETCDF:"ifile.nc":BC_Emissio ofile.nc.
Best,
Suvarna
RE: Remap Error: Generic Coordinates not supported - Added by Karin Meier-Fleischer over 1 year ago
If the grid is part of India I guess it is realley simple because only the units are wrong. Instead of meters it has to be degrees.
ncatted -O -a units,lon,o,c,"degrees_east" -a units,lat,o,c,"degrees_north" LE_Indore_BC_replace.nc LE_Indore_BC_replace_degrees.nc
plot_test.png (14.4 KB) plot_test.png |
RE: Remap Error: Generic Coordinates not supported - Added by Suvarna Tikle over 1 year ago
Yes. Thanks a lot. It's works.
RE: Remap Error: Generic Coordinates not supported - Added by Karin Meier-Fleischer over 1 year ago
Good to hear. It is always important to take care of the correct units when doing conversions or calculations.