NCDF_COORD Name
NDCF_COORD Purpose
The purpose of this function is to translate map projection and grid information
in a netCDF file into a map coordinate object (MAPCOORD) that can be used to
georeference images found in a netCDF file. Both the Coyote and Catalyst Libraries
are required to be on your IDL PATH.
Author
FANNING SOFTWARE CONSULTING
1645 Sheely Drive
Fort Collins
CO 80526 USA
Phone: 970-221-0438
E-mail: davidf@dfanning.com Category
Image display and map projection.
Calling Sequence
mapCoord = NCDF_Coord( netCDF_Filename )
Arguments
netCDF_Filename: The name of a netCDF file from which map projection and grid
information can be obtained.
Input Keywords
GRID_COLOR: The name of a color the map grid should be displayed with. The default
is "indian red". Color names are those supported by cgColor.
MAP_GRID: If a MapCoord object is made successfully, then setting this keyword
will add a Map_Grid object to the MapCoord object.
MAP_OUTLINE: If a MapCoord object is made successfully, then setting this keyword
will add a Map_Outline object to the MapCoord object.
OUTLINE_COLOR: The name of a color the map outline should be displayed with. The default
is "indian red". Color names are those supported by cgColor.
SILENT: IDL cannot map every GeoTiff image to a supported map projection or datum.
Normally, if the GeoTIFF image is unsupported, an error message is issued.
Setting this keyword will suppress such error messages. If you do this, you
MUST check the SUCCESS keyword to see if the program ran successfully. (Of
course, it is a good idea to check it in any case!)
USE_LATLON: If this keyword is set, the boundary ranges will be forced to be determined
from the latitude and longitude arrays in the file.
Output Keywords
SUCCESS: An output variable that will contain a 1 if the map coordinate object was
created successfully. Or to a 0 if it was not created successfully.
XRANGE: An output variable containing the X range (outside boundaries) of the
map projection grid in the file, if it can find them.
YRANGE: An output variable containing the Y range (outside boundaries) of the
map projection grid in the file, if it can find them.
Return Value
mapCoord A MAPCOORD object that can be used as the data coordinate object for
an image. Creation of this object requires that the Catalyst Library
be on your IDL path.
Notes
It is not possible to have a one-to-one mapping between every netCDF file and a map projection
in IDL, since IDL has a limited number of map projections and datums available. And, even at that,
I have not implemented all of IDL's map projections or datums, only those that I thought were most
likely to be encountered in my own work. If you run into a netCDF file that does not work in this
code (either because of an error in the code or because it is not supported), please contact me.
I am interested in supporting as many netCDF files as possible and I will take pains to do so if
I know they are needed.
Restrictions
Programs from both the Coyote and Catalyst Libraries are required to run this code.
http://www.dfanning.com/catalyst/howtoinstall.html
Modification History
Written by: David W. Fanning, 20 Feb 2010, DWF.
Added XRANGE and YRANGE keywords to return the map projection grid boundaries, if
they can be found in the netCDF file. 21 Feb 2010. DWF.
Found a problem when navigating Polar Stereograpic images and TRUE_SCALE_LATITUDE.
22 Mar 2010. DWF
Added USE_LATLON keyword. 31 Mar 2010. DWF.
Bug resulted in "half-pixel" being "full-pixel". Fixed. Borders now conform to
NSIDC-supplied borders. 6 April 2010. DWF
Typo in code that computes boundary when reading latitude and longitude arrays.
Fixed so that semi-minor axes is used correctly. 15 April 2010. DWF
Fixed a leaking memory problem from failing to delete the file object
created in the program when finished with it. 19 July 2010. DWF.