Overlaying data on a map
In order for contour, vector, and streamline data to be overlaid and plotted correctly on a map projection using one of the gsn_csm plot interfaces, one of the following conditions must be met:- The data must be two-dimensional and have latitude and longitude
coordinate arrays attached to it. In
addition, the longitude coordinate array must have a valid "units"
attribute of something like "degrees_east, "degrees-east", etc.
Similarly, the latitude coordinate array must have a valid units of
"degrees_north", "degrees-north", etc.
For some contour examples, see the cylindrical equidistant templates or the polar stereographic applications pages. For some vector and streamline examples, see the vectors and streamlines pages.
- The data must be two-dimensional, and have two-dimensional
latitude and longitude arrays that represent the locations of each
data value. These 2D lat/lon arrays must be attached as attributes to
the data called "lat2d" and "lon2d".
For some examples, see the POP scalars, POP vectors, or raster applications pages.
- If dealing with one-dimensional contour data, then the
res@sfXArray and
res@sfYArray resources
must be set to one-dimensional arrays of the same length. In this
case, a triangulation algorithm will be used to generate the
contours. Eventually, you will be able to do this for vector and
streamline data as well, using the res@vfXArray and res@vfYArray resources.
For some examples, see the triangular meshes or ORCA applications pages.
- If the data are already transformed onto a particular map
projection, and you don't have any kind of
latitude/longitude arrays associated with it, then the tfDoNDCOverlay resource must be set to
True, and the map limits must be set appropriately.
For some examples, see the native grid projections application page.
- If none of the above conditions apply, then you will need to
communicate the lat/lon information to the gsn_csm script in another
way. For contour data, You can do this by setting the sfXArray and sfYArray resources to arrays of
longitude/latitude values that represent the area your contours are to
be overlaid on. Or, if your latitude and/or longitude values are
equally spaced, you can just set sfXCStartV, sfXCEndV (for longitude) and sfYCStartV, sfYCEndV (for latitude).
Likewise, for vector and streamline data, you can use the corresponding resources: vfXArray and vfYArray, or vfXCStartV, vfXCEndV, vfYCStartV, and vfYCEndV.