NetCDF write [message #79647] |
Thu, 15 March 2012 00:02 |
Fabrice Lambert
Messages: 6 Registered: March 2012
|
Junior Member |
|
|
Hi everybody,
I am trying to write a 2-dimensional dataset to a netCDF file. The
data is as follows:
IDL> help, aodtot
AODTOT FLOAT = Array[128, 64]
Basically it's a world map with 128 points in longitude and 64 points
in latitude.
Here's the code I am using to write the netCDF data:
;----------------------------------------------------------- ------------------------
lon=findgen(128)*2.8125
lat=findgen(64)*2.8125-88.59375
id = NCDF_CREATE('AOD_CCSM_LGM.nc', /CLOBBER) ; Create a new NetCDF
file. LGM
NCDF_CONTROL, id, /FILL ; Fill the file with default values.
xid = NCDF_DIMDEF(id, 'lon', 128) ; Make dimensions.
yid = NCDF_DIMDEF(id, 'lat', 64) ; Make dimensions.
lonid = NCDF_VARDEF(id, 'lon', [xid], /FLOAT) ; Define variables.
latid = NCDF_VARDEF(id, 'lat', [yid], /FLOAT) ; Define variables.
aodtotid = NCDF_VARDEF(id, 'AODtot', [xid, yid], /FLOAT) ; Define
variables.
NCDF_CONTROL, id, /ENDEF ; Put file in data mode.'
NCDF_VARPUT, id, lonid, lon ; Input data.
NCDF_VARPUT, id, latid, lat ; Input data.
NCDF_VARPUT, id, aodtotid, aodtot ; Input data.
end
;----------------------------------------------------------- ---------------------
The problem is that all data above the 47th latitudinal value are
empty (i.e. the northernmost part of the world is missing). If I write
the aodtot variable to a textfile, then no data are missing, so I'm
doing something wrong in the netcdf part. Can anybody spot a mistake?
|
|
|