I resampled NetCDF data and organized in OrderedDict(This is the original organization of original data). But when I use the following script to write it in a new netcdf file:
ncout.createDimension('lat', len(y))
ncout.createDimension('lon', len(x))
# create latitude axis
lat = ncout.createVariable('lat', np.dtype('float64').char, ('lat'))
lat.standard_name = 'latitude'
lat.long_name = 'latitude'
lat.units = 'degrees_north'
lat.axis = 'Y'
# create longitude axis
lon = ncout.createVariable('lon', np.dtype('float64').char, ('lon'))
lon.standard_name = 'longitude'
lon.long_name = 'longitude'
lon.units = 'degrees_east'
lon.axis = 'X'
# create variable array
for key, value in variables.items():
var = ncout.createVariable(key+'re', np.dtype('float32').char, ('lon', 'lat'))
var.long_name =key
var=value
# copy axis from the original dataset
#time= nc_file.time_coverage_end
lon = lons
lat= lats
The output value inside the new file becomes the same value: '9969209968386869046778552952102584320.000' I can not find where the problem is and how I can do that. I have made sure that the output of resample is correct. Could you please give me some advice?