madPcolorWedgeKmlScan is the class that produces pcolor scan kml files where data is drawn as wedge shapes.
Usage example:
obj = madPcolorWedgeKmlScan(isprintText,
'az',
'./isprint.kml',
minColormap = 9,
maxColormap = 12)
Non-standard Python modules used:
matplotlib
Change history:
Written by Bill Rideout Dec 15, 2010
Methods
|
|
__init__
_createKmlText
_generateWedges
_getKmlRGB
_getLimits
_getWedge
getGreatCircleDist
|
|
__init__
|
__init__ (
self,
isprintText,
scanType,
fullFilename,
minColormap=None,
maxColormap=None,
instName=None,
instDesc=None,
instLat=None,
instLon=None,
instAlt=None,
colorMap=None,
)
__init__ writes a madPcolorWedgeKmlScan to a file.
Inputs:
isprintText - a string giving isprint output without headers. The 9 parameters
are (gdlatr, gdlonr, galtr, range, az1, az2, el1, el2, <parameter value>). Any
missing data should be written as "missing" or other string that
cannot be converted to a float. gdlatr, gdlonr, galtr are the station location
scanType - must be az or el_lat (for north or south el scans), el_lon
(for east or west el scans) or el_gcdist (for all other el scans.
For az - x is long, y is lat
for el_* y is always alt, and x is either lat, lon, or great circle distance
fullFilename - full path of file containing kml file to be saved. Extension must
be kml, or exception thrown.
minColormap - minimum parameter value (defaults to lowest parameter value)
maxColormap - maximum parameter value (defaults to highest parameter value). However, if
both minColormap and maxColormap == None, autoscaling applied.
instName, instDesc, instLat, instLon, instAlt - used to create a placemark for the radar. If
instLat or instLon missing, no placemark added.
colorMap - A matplotlib colormap to use to create colors. If None, then blue minimum and red maximum
Returns: void
Affects: Writes fullFilename to disk
Exceptions
|
|
ValueError, 'scanType must be "az", "el_lat", "el_lon", "el_gcdist", not %s' %(str( scanType ) )
|
|
|
_createKmlText
|
_createKmlText (
self,
dataGen,
maxColormap,
minColormap,
lookLat,
lookLon,
lookAlt,
scanType,
instName,
instDesc,
instLat,
instLon,
instAlt,
colorMap,
)
_createKmlText creates kml text
Inputs:
dataGen - list in form (dataValue, (point1_lat, point1_lon, point1_alt), (point2_lat, point2_lon, point2_alt),
(point3_lat, point3_lon, point3_alt), (point4_lat, point4_lon, point4_alt))
maxColormap
minColormap
lookLat
lookLon
lookAlt
scanType
instName, instDesc, instLat, instLon, instAlt - - used to create a placemark for the radar. If
instLat or instLon missing, no placemark added.
colorMap - A matplotlib colormap to use to create colors. If None, then blue minimum and red maximum
|
|
_generateWedges
|
_generateWedges (
self,
isprintLines,
scanType,
)
_generateWedges is a python generator that return a data wedge in the form
(dataValue, (point1_lat, point1_lon, point1_alt), (point2_lat, point2_lon, point2_alt),
(point3_lat, point3_lon, point3_alt), (point4_lat, point4_lon, point4_alt))
Inputs:
isprintLines - a list of line with 9 parameters that
are (gdlatr, gdlonr, galtr, range, az1, az2, el1, el2, <parameter value>). Any
missing data should be written as "missing" or other string that
cannot be converted to a float. gdlatr, gdlonr, galtr are the station location.
No wedge is returned for a missing data line
scanType - must be az or el_lat (for north or south el scans), el_lon
(for east or west el scans) or el_gcdist (for all other el scans.
For az - x is long, y is lat
for el_* y is always alt, and x is either lat, lon, or great circle distance
|
|
_getKmlRGB
|
_getKmlRGB (
self,
value,
transparent=False,
wrap=False,
)
_getKmlRGB returns a Kml color string given a value between 0 qnd 1.
If transparent == False, solid color. Otherwise transpanency set to 50%
If wrap, colors at zero and 1 wrap. Otherwise, extremes red and blue
If invert, use value = 1 - value
Exceptions
|
|
ValueError, 'value must be between 0 and 1, not %f' %( value )
|
|
|
_getLimits
|
_getLimits ( self, isprintLines )
returns (newLonMax, newLonMin, newLatMax, newLatMin, newAltMax, newGreatCDist, newParmMax, newParmMin)
given isprint lines with
parameters (gdlatr, gdlonr, galtr, range, az1, az2, el1, el2, <parameter value>)
We only look at the end points of ranges and the station location
|
|
_getWedge
|
_getWedge (
self,
gdlatr,
gdlonr,
galtr,
range,
diffRange1,
diffRange2,
az1,
az2,
el1,
el2,
value,
)
_getWedge returns return a data wedge in the form
(dataValue, (point1_lat, point1_lon, point1_alt), (point2_lat, point2_lon, point2_alt),
(point3_lat, point3_lon, point3_alt), (point4_lat, point4_lon, point4_alt)).
Inputs:
gdlatr, gdlonr, galtr - location of radar
range, diffRange1, diffRange2 - range of center of wedge, and distance in and out from there
az1, az2, el1, el2 - start and end aximuth and elevation. Which is used depends on scanType
value - float data value
|
|
getGreatCircleDist
|
getGreatCircleDist (
self,
gdlatr,
glonr,
gdlat,
glon,
)
getGreatCircleDist return the great circle distance in. Taken from madDeriveMethods c code.
Inputs: gdlatr, glonr: reference point on earth's surface
gdlat, glon: second point on earth's surface
|
|