Error (cdf_close) : NetCDF: HDF error: when I want to remap
Added by Sam United over 7 years ago
Hi,
I want to use cdo to remap a source file (cropped_example.nc) into a new remaped file. When I run the code as
cdo remapnn,grid_180 cropped_example.nc example.nc
But got the errors as :
cdo remapnn (Abort): Unsupported grid type: generic
HDF5-DIAG: Error detected in HDF5 (1.8.11) thread 0:
#000: H5T.c line 1761 in H5Tclose(): not a datatype
major: Invalid arguments to routine
minor: Inappropriate type
Error (cdf_close) : NetCDF: HDF error
How can I fix this problem?
Thank you in advance
Sam
| cropped_example.nc (39.7 KB) cropped_example.nc | |||
| grid_180 (79 Bytes) grid_180 |
Replies (4)
RE: Error (cdf_close) : NetCDF: HDF error: when I want to remap - Added by Karin Meier-Fleischer over 7 years ago
Hi Sam,
you have to add some attributes to the coordinate variables and the data variable, first.
ncatted -O -a coordinates,emissions,c,c,"Latitude Longitude" \
-a standard_name,Latitude,c,c,"latitude" \
-a standard_name,Longitude,c,c,"longitude" \
cropped_example.nc tmp.nc
cdo remapnn,grid_180 tmp.nc example.nc
But did you see that your data is always 0.0?
cdo infon cropped_example.nc
-1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name
1 :-0001-12-31 01:00:00 0 11 0 : 79.875 81.125 82.375 : Latitude
2 :-0001-12-31 01:00:00 0 26 0 : -173.62 -170.50 -167.38 : Longitude
3 :-0001-12-31 01:00:00 0 286 0 : 0.0000 0.0000 0.0000 : emissions
4 : 0000-01-31 01:00:00 0 286 0 : 0.0000 0.0000 0.0000 : emissions
5 : 0000-02-29 01:00:00 0 286 0 : 0.0000 0.0000 0.0000 : emissions
6 : 0000-03-31 01:00:00 0 286 0 : 0.0000 0.0000 0.0000 : emissions
7 : 0000-04-30 01:00:00 0 286 0 : 0.0000 0.0000 0.0000 : emissions
8 : 0000-05-31 01:00:00 0 286 0 : 0.0000 0.0000 0.0000 : emissions
9 : 0000-06-30 01:00:00 0 286 0 : 0.0000 0.0000 0.0000 : emissions
10 : 0000-07-31 01:00:00 0 286 0 : 0.0000 0.0000 0.0000 : emissions
11 : 0000-08-31 01:00:00 0 286 0 : 0.0000 0.0000 0.0000 : emissions
12 : 0000-09-30 01:00:00 0 286 0 : 0.0000 0.0000 0.0000 : emissions
13 : 0000-10-31 01:00:00 0 286 0 : 0.0000 0.0000 0.0000 : emissions
14 : 0000-11-30 01:00:00 0 286 0 : 0.0000 0.0000 0.0000 : emissions
cdo infon: Processed 3469 values from 3 variables over 12 timesteps ( 0.00s 21MB )
-Karin
RE: Error (cdf_close) : NetCDF: HDF error: when I want to remap - Added by Sam United over 7 years ago
Hi Karin,
Thank you very much! but I do not know why the 'time' variable changed to
Time = 1, 2, 2.93548387096774, 4, 4.96774193548387, 6, 6.96774193548387, 8,
9, 9.96774193548387, 11, 11.9677419354839 ;
rather than 1,2,3,...12
Cheers
Sam
RE: Error (cdf_close) : NetCDF: HDF error: when I want to remap - Added by Karin Meier-Fleischer over 7 years ago
The time coordinate variable Time is not set properly:
cdo showtimestamp cropped_example.nc -0001-12-31T01:00:00 0000-01-31T01:00:00 0000-02-29T01:00:00 0000-03-31T01:00:00 0000-04-30T01:00:00 0000-05-31T01:00:00 0000-06-30T01:00:00 0000-07-31T01:00:00 0000-08-31T01:00:00 0000-09-30T01:00:00 0000-10-31T01:00:00 0000-11-30T01:00:00 cdo showtimestamp: Processed 3 variables over 12 timesteps ( 0.00s 20MB )The reference time is
Time:units = "months since Jan 01, 1997"but should be
Time:units = "months since 1997-1-1 01:00:00"To get the right time values you have to use the settaxis operator:
cdo -L -settaxis,1997-01-01,01:00:00,1mon -remapnn,grid_180 tmp.nc example.ncNow, the time is ok:
cdo showtimestamp example.nc 1997-01-01T01:00:00 1997-02-01T01:00:00 1997-03-01T01:00:00 1997-04-01T01:00:00 1997-05-01T01:00:00 1997-06-01T01:00:00 1997-07-01T01:00:00 1997-08-01T01:00:00 1997-09-01T01:00:00 1997-10-01T01:00:00 1997-11-01T01:00:00 1997-12-01T01:00:00 cdo showtimestamp: Processed 1 variable over 12 timesteps ( 0.00s 20MB )and
ncdump -v Time example.nc
netcdf example {
dimensions:
Time = UNLIMITED ; // (12 currently)
lon = 96 ;
lat = 72 ;
variables:
double Time(Time) ;
Time:standard_name = "time" ;
Time:units = "months since 1997-1-1 01:00:00" ;
Time:calendar = "standard" ;
Time:axis = "T" ;
float lon(lon) ;
lon:standard_name = "longitude" ;
lon:long_name = "longitude" ;
lon:units = "degrees_east" ;
lon:axis = "X" ;
float lat(lat) ;
lat:standard_name = "latitude" ;
lat:long_name = "latitude" ;
lat:units = "degrees_north" ;
lat:axis = "Y" ;
double emissions(Time, lat, lon) ;
// global attributes:
:CDI = "Climate Data Interface version 1.9.2 (http://mpimet.mpg.de/cdi)" ;
:Conventions = "CF-1.6" ;
:history = "Mon Aug 20 15:53:24 2018: cdo -L -settaxis,1997-01-01,01:00:00,1mon -remapnn,grid_180 tmp.nc example.nc\nMon Aug 20 15:53:24 2018: ncatted -O -a coordinates,emissions,c,c,Latitude Longitude -a standard_name,Latitude,c,c,latitude -a standard_name,Longitude,c,c,longitude cropped_example.nc tmp.nc\nMon Aug 20 11:01:24 2018: ncks -d lat,30,40 -d lon,25,50 emis_1997.nc -O cropped_example.nc\nCreated by Sam 20/08/18" ;
:description = "Emissions (gc/m2/month) in each grid cell" ;
:NCO = "4.6.7" ;
:CDO = "Climate Data Operators version 1.9.2 (http://mpimet.mpg.de/cdo)" ;
data:
Time = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ;
}
-Karin
RE: Error (cdf_close) : NetCDF: HDF error: when I want to remap - Added by Sam United over 7 years ago
Hi Karin,
Thank you very much. You solved my problem perfectly.
Sam