Coyote Graphics Map Projection Routines

Date: Fri Nov 29 13:44:27 2013

single page | use frames     summary     class     fields     routine details     file attributes

.\

cgncdfmap.pro

Graphics, Map Projections


The purpose of this function is to translate map projection information found in a netCDF file into a map coordinate object (cgMap) that can be used to georeference images with a map data coordinate system. The Coyote Library is required.

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.

Examples

To create a map coordinate from a netCDF file from NSIDC:

file = 'C:\IDL\data\netCDF\jun_2004_amsr_e_bt.nc' mapCoord = cgNCDFMap(file, /Continents, /Grid)

Author information

Author

FANNING SOFTWARE CONSULTING:

David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: david@idlcoyote.com Coyote's Guide to IDL Programming: http://www.idlcoyote.com/

Copyright

Copyright (c) 2011, Fanning Software Consulting, Inc.

History

Converted from old ncdf_Coord program in Catalyst Library to run with Coyote Graphics routines. 9 November 2011. David W. Fanning.

Routines

result = cgNCDFMap_GetMapUnit(varWithMap, fileObj [, /SILENT])

Finds the correct projected map unit from the file.

result = cgNCDFMap_FindBoundary(varWithMap, thisMapVar, fileObj, mapCoord [, /SILENT] [, XRANGE=double] [, YRANGE=double] [, /USE_LATLON])

Finds the boundary (XRANGE and YRANGE) of the map coordinate space and assigns these to the map object.

result = cgNCDFMap_EllipseAxes(varWithMap, thisMapVar, fileObj [, /SILENT] [, SEMIMAJOR_AXIS=double] [, SEMIMINOR_AXIS=double])

Finds the length of the semi-major and semi-minor axes of the ellipsoid used in the netCDF file.

result = cgNCDFMap( [ncdf_filename] [, GCOLOR=string] [, /GRID] [, /CONTINENTS] [, CCOLOR=string] [, MCOLOR=string] [, /ONIMAGE] [, /SILENT] [, /SUCCESS] [, TITLE=string] [, /USE_LATLON] [, XRANGE=double] [, YRANGE=double])

The purpose of this function is to translate map projection information found in a netCDF file into a map coordinate object (cgMap) that can be used to georeference images with a map data coordinate system.

Routine details

top cgNCDFMap_GetMapUnit

result = cgNCDFMap_GetMapUnit(varWithMap, fileObj [, /SILENT])

Finds the correct projected map unit from the file. Assumes meters.

Parameters

varWithMap in required type=string

The name of the variable in the netCDF file that contains map projection information.

fileObj in required type=object

The netCDF file object (ncdf_file) which can parse the netCDF file.

Keywords

SILENT in optional type=boolean default=0

If set, do not report errors.

top cgNCDFMap_FindBoundary

result = cgNCDFMap_FindBoundary(varWithMap, thisMapVar, fileObj, mapCoord [, /SILENT] [, XRANGE=double] [, YRANGE=double] [, /USE_LATLON])

Finds the boundary (XRANGE and YRANGE) of the map coordinate space and assigns these to the map object.

Parameters

varWithMap in required type=string

The name of the variable in the netCDF file that contains map projection information.

thisMapVar in required type=string

The name of the map projection variable identified by the grid_mapping attribute of the varWithMap variable.

fileObj in required type=object

The netCDF file object (ncdf_file) which can parse the netCDF file.

mapCoord in required type=object

The map coordinate object we are creating. The XRange and YRange of the discovered boundaries are assigned to this object.

Keywords

SILENT in optional type=boolean default=0

If set, do not report errors.

XRANGE out optional type=double

The discovered X projected meter range of the map projection.

YRANGE out optional type=double

The discovered Y projected meter range of the map projection.

USE_LATLON in optional type=boolean default=0

If this keyword is set, the boundary ranges will be forced to be determined from the latitude and longitude arrays in the file.

top cgNCDFMap_EllipseAxes

result = cgNCDFMap_EllipseAxes(varWithMap, thisMapVar, fileObj [, /SILENT] [, SEMIMAJOR_AXIS=double] [, SEMIMINOR_AXIS=double])

Finds the length of the semi-major and semi-minor axes of the ellipsoid used in the netCDF file.

Parameters

varWithMap in required type=string

The name of the variable in the netCDF file that contains map projection information.

thisMapVar in required type=string

The name of the map projection variable identified by the grid_mapping attribute of the varWithMap variable.

fileObj in required type=object

The netCDF file object (ncdf_file) which can parse the netCDF file.

Keywords

SILENT in optional type=boolean default=0

If set, do not report errors.

SEMIMAJOR_AXIS out optional type=double

The length of the semi-major axis.

SEMIMINOR_AXIS out optional type=double

The length of the semi-minor axis.

top cgNCDFMap

result = cgNCDFMap( [ncdf_filename] [, GCOLOR=string] [, /GRID] [, /CONTINENTS] [, CCOLOR=string] [, MCOLOR=string] [, /ONIMAGE] [, /SILENT] [, /SUCCESS] [, TITLE=string] [, /USE_LATLON] [, XRANGE=double] [, YRANGE=double])

The purpose of this function is to translate map projection information found in a netCDF file into a map coordinate object (cgMap) that can be used to georeference images with a map data coordinate system. The Coyote Library is required.

Parameters

ncdf_filename in optional type=string

The name of a netCDF file containing map projection information from which a cgMap object can be created.

Keywords

GCOLOR in optional type=string default=Gray

The name of a color the map grid should be displayed with. The default is "gray". Color names are those supported by cgColor.

GRID in optional type=boolean default=0

If a cgMap object is made successfully, then setting this keyword will add a cgMapGrid object to the cgMap object.

CONTINENTS in optional type=boolean default=0

If a cgMap object is made successfully, then setting this keyword will add a cgMapContinents object to the cgMap object.

CCOLOR in optional type=string default=Charcoal

The name of a color the map continents should be displayed with. The default is "charcoal". Color names are those supported by cgColor.

MCOLOR in optional type=string default=Black

The name of a color the map should be displayed in. (Normally the map border and map title are displayed in this color.)

ONIMAGE in optional type=boolean default=0

Set this keword if the map object is to get its position from the last cgImage command issued.

SILENT in optional type=boolean default=0

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!)

SUCCESS out optional type=boolean default=0

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.

TITLE in optional type=string

The title of the map projection.

USE_LATLON in optional type=boolean default=0

If this keyword is set, the boundary ranges will be forced to be determined from the latitude and longitude arrays in the file.

XRANGE out optional type=double

The discovered X projected meter range of the map projection.

YRANGE out optional type=double

The discovered Y projected meter range of the map projection.

File attributes

Modification date: Mon Nov 04 17:05:42 2013
Lines: 710
Docformat: rst rst