Documente Academic
Documente Profesional
Documente Cultură
http://www.atmos.umd.edu/~gcm/usefuldocs/hdf_netcdf/IDL_hdf-netcdf...
Once you are completely familiar with the file steps 2, 3, 5 and 6 may be omitted. Required syntax will be
designated by bold script, user supplied variables by italics. The user supplied variables may be displayed by
using the print command. I will include examples as though you were typing it directly while in the IDL
environment.
25-07-2014 14:36
2 de 5
http://www.atmos.umd.edu/~gcm/usefuldocs/hdf_netcdf/IDL_hdf-netcdf...
25-07-2014 14:36
3 de 5
http://www.atmos.umd.edu/~gcm/usefuldocs/hdf_netcdf/IDL_hdf-netcdf...
information has been saved in 'cloud_info.txt'. You can open this file to find what the variables are named so
that you can use the exact character string to extract the data.
The modread.pro procedure will read a specified variable from an HDF file, convert it from integerized form,
and also provide information like the variable dimensions and the fill value (which it replaces with the IDL
fill value !Values.F_NaN). Let's look at the 'Cloud_Top_Temperature' variable. The procedure requires a file
name, but instead of spelling the whole thing out, let's pick out out of a list and store it in a variable called
'filename':
filename = dialog_pickfile(filter='*.hdf')
Now we can read the data and put it in the variable Tcld using the following command:
modread, filename, Tcld, 'Cloud_Top_Temperature', dims, fillvalue
Now that the variable is stored in Tcld, you can explore it using IDL.
25-07-2014 14:36
4 de 5
http://www.atmos.umd.edu/~gcm/usefuldocs/hdf_netcdf/IDL_hdf-netcdf...
variables one by one by index in order to find the one you want.
5. Read the variable attributes
First get the name of the attribute by index
attname=ncdf_attname(fileID,varndx,attndx)
Now read the attribute
ncdf_attget,fileID,varndx,attname,value
Note how this uses the same command as for getting global attributes, but the variable index must be
included when the /global switch is not set.
6. Get an ID for the variable
varID=ncdf_varid(fileID,varname)
7. Import the selected dataset
ncdf_varget,fileID,varID,variable
If the data is in integerized form, you will need to convert it to the true values using the scale factor and offset
that (hopefully) is stored in the attributes for the variable.
Now you're done!
IDL Procedures for Exploring and Reading netCDF Data
You will need to copy the goes data file to your directory, as well as the IDL procedures 'ncdfshow.pro' and
'ncdfread.pro'.
The ncdfshow.pro procedure will find the number of variables, the number of attributes per variable, and loop
through them in order to write them into a text file that you specify. To run it from the IDL command line
type:
ncdfshow,'fileinfo.txt'
Where you should typically provide something more descriptive than 'fileinfo' to write the result into. You
will be prompted to select a file, so select the GOES data file provided. After it runs, open fileinfo.txt and see
what information is in the file.
Now that you know the name of the variable you want to look at, you can run the ncdfread.pro procedure to
get the data in raw form. You will want to put the actual filename into a variable that's a little easier to handle
first.
filename = dialog_pickfile()
ncdfread,filename,'variable_name',data_variable,dims
Where 'variable_name' is a string that must match exactly the name you found in 'fileinfo.txt', data_variable is
where the data ends up, and dims is a vector of the array dimensions.
25-07-2014 14:36
5 de 5
http://www.atmos.umd.edu/~gcm/usefuldocs/hdf_netcdf/IDL_hdf-netcdf...
Now you have the data in an IDL variable, you may need to use any offset and scale information found in the
attributes to scale it to a physically meaningful quantity.
25-07-2014 14:36