Core (pyart.core
)¶
Core Py-ART classes and function for interacting with weather radar data.
Core classes¶
Radar (time, _range, fields, metadata, …[, …]) |
A class for storing antenna coordinate radar data. |
Grid (time, fields, metadata, …[, …]) |
A class for storing rectilinear gridded radar data in Cartesian coordinate. |
HorizontalWindProfile (height, speed, direction) |
Horizontal wind profile. |
RadarSpectra (time, _range, fields, metadata, …) |
A class for storing antenna coordinate radar spectra data. |
Coordinate transformations¶
antenna_to_cartesian (ranges, azimuths, …) |
Return Cartesian coordinates from antenna coordinates. |
antenna_vectors_to_cartesian (ranges, …[, …]) |
Calculate Cartesian coordinate for gates from antenna coordinate vectors. |
cartesian_to_geographic (x, y, projparams) |
Cartesian to Geographic coordinate transform. |
cartesian_vectors_to_geographic (x, y, projparams) |
Cartesian vectors to Geographic coordinate transform. |
cartesian_to_geographic_aeqd (x, y, lon_0, lat_0) |
Azimuthal equidistant Cartesian to geographic coordinate transform. |
cartesian_to_antenna (x, y, z) |
Returns antenna coordinates from Cartesian coordinates. |
geographic_to_cartesian (lon, lat, projparams) |
Geographic to Cartesian coordinate transform. |
geographic_to_cartesian_aeqd (lon, lat, …) |
Azimuthal equidistant geographic to Cartesian coordinate transform. |
wgs84_to_swissCH1903 (lon, lat, alt[, …]) |
Convert WGS84 coordinates to swiss coordinates (CH1903 / LV03) |
-
class
pyart.core.
Grid
(time, fields, metadata, origin_latitude, origin_longitude, origin_altitude, x, y, z, projection=None, radar_latitude=None, radar_longitude=None, radar_altitude=None, radar_time=None, radar_name=None)[source]¶ Bases:
object
A class for storing rectilinear gridded radar data in Cartesian coordinate.
Refer to the attribute section for information on the parameters.
To create a Grid object using legacy parameters present in Py-ART version 1.5 and before, use
from_legacy_parameters()
, grid = Grid.from_legacy_parameters(fields, axes, metadata).Attributes: - time : dict
Time of the grid.
- fields : dict of dicts
Moments from radars or other variables.
- metadata : dict
Metadata describing the grid.
- origin_longitude, origin_latitude, origin_altitude : dict
Geographic coordinate of the origin of the grid.
- x, y, z : dict, 1D
Distance from the grid origin for each Cartesian coordinate axis in a one dimensional array. Defines the spacing along the three grid axes which is repeated throughout the grid, making a rectilinear grid.
- nx, ny, nz : int
Number of grid points along the given Cartesian dimension.
- projection : dic or str
Projection parameters defining the map projection used to transform from Cartesian to geographic coordinates. None will use the default dictionary with the ‘proj’ key set to ‘pyart_aeqd’ indicating that the native Py-ART azimuthal equidistant projection is used. Other values should specify a valid pyproj.Proj projparams dictionary or string. The special key ‘_include_lon_0_lat_0’ is removed when interpreting this dictionary. If this key is present and set to True, which is required when proj=’pyart_aeqd’, then the radar longitude and latitude will be added to the dictionary as ‘lon_0’ and ‘lat_0’. Use the
get_projparams()
method to retrieve a copy of this attribute dictionary with this special key evaluated.- radar_longitude, radar_latitude, radar_altitude : dict or None, optional
Geographic location of the radars which make up the grid.
- radar_time : dict or None, optional
Start of collection for the radar which make up the grid.
- radar_name : dict or None, optional
Names of the radars which make up the grid.
- nradar : int
Number of radars whose data was used to make the grid.
- projection_proj : Proj
pyproj.Proj instance for the projection specified by the projection attribute. If the ‘pyart_aeqd’ projection is specified accessing this attribute will raise a ValueError.
- point_x, point_y, point_z : LazyLoadDict
The Cartesian locations of all grid points from the origin in the three Cartesian coordinates. The three dimensional data arrays contained these attributes are calculated from the x, y, and z attributes. If these attributes are changed use :py:func: init_point_x_y_z to reset the attributes.
- point_longitude, point_latitude : LazyLoadDict
Geographic location of each grid point. The projection parameter(s) defined in the projection attribute are used to perform an inverse map projection from the Cartesian grid point locations relative to the grid origin. If these attributes are changed use
init_point_longitude_latitude()
to reset the attributes.- point_altitude : LazyLoadDict
The altitude of each grid point as calculated from the altitude of the grid origin and the Cartesian z location of each grid point. If this attribute is changed use
init_point_altitude()
to reset the attribute.
Methods
add_field
(self, field_name, field_dict[, …])Add a field to the object. get_point_longitude_latitude
(self[, level, …])Return arrays of longitude and latitude for a given grid height level. get_projparams
(self)Return a projparam dict from the projection attribute. init_point_altitude
(self)Initialize the point_altitude attribute. init_point_longitude_latitude
(self)Initialize or reset the point_{longitude, latitudes} attributes. init_point_x_y_z
(self)Initialize or reset the point_{x, y, z} attributes. to_xarray
(self)Convert the Grid object to an xarray format. write
(self, filename[, format, …])Write the the Grid object to a NetCDF file. -
__class__
¶ alias of
builtins.type
-
__delattr__
(self, name, /)¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'pyart.core.grid', '__doc__': "\n A class for storing rectilinear gridded radar data in Cartesian coordinate.\n\n Refer to the attribute section for information on the parameters.\n\n To create a Grid object using legacy parameters present in Py-ART version\n 1.5 and before, use :py:func:`from_legacy_parameters`,\n grid = Grid.from_legacy_parameters(fields, axes, metadata).\n\n Attributes\n ----------\n time : dict\n Time of the grid.\n fields : dict of dicts\n Moments from radars or other variables.\n metadata : dict\n Metadata describing the grid.\n origin_longitude, origin_latitude, origin_altitude : dict\n Geographic coordinate of the origin of the grid.\n x, y, z : dict, 1D\n Distance from the grid origin for each Cartesian coordinate axis in a\n one dimensional array. Defines the spacing along the three grid axes\n which is repeated throughout the grid, making a rectilinear grid.\n nx, ny, nz : int\n Number of grid points along the given Cartesian dimension.\n projection : dic or str\n Projection parameters defining the map projection used to transform\n from Cartesian to geographic coordinates. None will use the default\n dictionary with the 'proj' key set to 'pyart_aeqd' indicating that\n the native Py-ART azimuthal equidistant projection is used. Other\n values should specify a valid pyproj.Proj projparams dictionary or\n string. The special key '_include_lon_0_lat_0' is removed when\n interpreting this dictionary. If this key is present and set to True,\n which is required when proj='pyart_aeqd', then the radar longitude and\n latitude will be added to the dictionary as 'lon_0' and 'lat_0'.\n Use the :py:func:`get_projparams` method to retrieve a copy of this\n attribute dictionary with this special key evaluated.\n radar_longitude, radar_latitude, radar_altitude : dict or None, optional\n Geographic location of the radars which make up the grid.\n radar_time : dict or None, optional\n Start of collection for the radar which make up the grid.\n radar_name : dict or None, optional\n Names of the radars which make up the grid.\n nradar : int\n Number of radars whose data was used to make the grid.\n projection_proj : Proj\n pyproj.Proj instance for the projection specified by the projection\n attribute. If the 'pyart_aeqd' projection is specified accessing this\n attribute will raise a ValueError.\n point_x, point_y, point_z : LazyLoadDict\n The Cartesian locations of all grid points from the origin in the\n three Cartesian coordinates. The three dimensional data arrays\n contained these attributes are calculated from the x, y, and z\n attributes. If these attributes are changed use :py:func:\n `init_point_x_y_z` to reset the attributes.\n point_longitude, point_latitude : LazyLoadDict\n Geographic location of each grid point. The projection parameter(s)\n defined in the `projection` attribute are used to perform an inverse\n map projection from the Cartesian grid point locations relative to\n the grid origin. If these attributes are changed use\n :py:func:`init_point_longitude_latitude` to reset the attributes.\n point_altitude : LazyLoadDict\n The altitude of each grid point as calculated from the altitude of the\n grid origin and the Cartesian z location of each grid point. If this\n attribute is changed use :py:func:`init_point_altitude` to reset the\n attribute.\n\n ", '__init__': <function Grid.__init__>, '__getstate__': <function Grid.__getstate__>, '__setstate__': <function Grid.__setstate__>, 'projection_proj': <property object>, 'get_projparams': <function Grid.get_projparams>, '_find_and_check_nradar': <function Grid._find_and_check_nradar>, 'init_point_x_y_z': <function Grid.init_point_x_y_z>, 'init_point_longitude_latitude': <function Grid.init_point_longitude_latitude>, 'init_point_altitude': <function Grid.init_point_altitude>, 'write': <function Grid.write>, 'to_xarray': <function Grid.to_xarray>, 'add_field': <function Grid.add_field>, 'get_point_longitude_latitude': <function Grid.get_point_longitude_latitude>, '__dict__': <attribute '__dict__' of 'Grid' objects>, '__weakref__': <attribute '__weakref__' of 'Grid' objects>})¶
-
__dir__
(self, /)¶ Default dir() implementation.
-
__eq__
(self, value, /)¶ Return self==value.
-
__format__
(self, format_spec, /)¶ Default object formatter.
-
__ge__
(self, value, /)¶ Return self>=value.
-
__getattribute__
(self, name, /)¶ Return getattr(self, name).
-
__gt__
(self, value, /)¶ Return self>value.
-
__hash__
(self, /)¶ Return hash(self).
-
__init__
(self, time, fields, metadata, origin_latitude, origin_longitude, origin_altitude, x, y, z, projection=None, radar_latitude=None, radar_longitude=None, radar_altitude=None, radar_time=None, radar_name=None)[source]¶ Initalize object.
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__
(self, value, /)¶ Return self<=value.
-
__lt__
(self, value, /)¶ Return self<value.
-
__module__
= 'pyart.core.grid'¶
-
__ne__
(self, value, /)¶ Return self!=value.
-
__new__
(*args, **kwargs)¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
(self, /)¶ Helper for pickle.
-
__reduce_ex__
(self, protocol, /)¶ Helper for pickle.
-
__repr__
(self, /)¶ Return repr(self).
-
__setattr__
(self, name, value, /)¶ Implement setattr(self, name, value).
-
__sizeof__
(self, /)¶ Size of object in memory, in bytes.
-
__str__
(self, /)¶ Return str(self).
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)
-
_find_and_check_nradar
(self)[source]¶ Return the number of radars which were used to create the grid.
Examine the radar attributes to determine the number of radars which were used to create the grid. If the size of the radar attributes are inconsistent a ValueError is raised by this method.
-
add_field
(self, field_name, field_dict, replace_existing=False)[source]¶ Add a field to the object.
Parameters: - field_name : str
Name of the field to the fields dictionary.
- field_dict : dict
Dictionary containing field data and metadata.
- replace_existing : bool, optional
True to replace the existing field with key field_name if it exists, overwriting the existing data. If False, a ValueError is raised if field_name already exists.
-
get_point_longitude_latitude
(self, level=0, edges=False)[source]¶ Return arrays of longitude and latitude for a given grid height level.
Parameters: - level : int, optional
Grid height level at which to determine latitudes and longitudes. This is not currently used as all height level have the same layout.
- edges : bool, optional
True to calculate the latitude and longitudes of the edges by interpolating between Cartesian coordinates points and extrapolating at the boundaries. False to calculate the locations at the centers.
Returns: - longitude, latitude : 2D array
Arrays containing the latitude and longitudes, in degrees, of the grid points or edges between grid points for the given height.
-
init_point_longitude_latitude
(self)[source]¶ Initialize or reset the point_{longitude, latitudes} attributes.
-
projection_proj
¶
-
to_xarray
(self)[source]¶ Convert the Grid object to an xarray format.
Attributes: - time : dict
Time of the grid.
- fields : dict of dicts
Moments from radars or other variables.
- longitude, latitude : dict, 2D
Arrays of latitude and longitude for the grid height level.
- x, y, z : dict, 1D
Distance from the grid origin for each Cartesian coordinate axis in a one dimensional array.
-
write
(self, filename, format='NETCDF4', arm_time_variables=False, arm_alt_lat_lon_variables=False)[source]¶ Write the the Grid object to a NetCDF file.
Parameters: - filename : str
Filename to save to.
- format : str, optional
NetCDF format, one of ‘NETCDF4’, ‘NETCDF4_CLASSIC’, ‘NETCDF3_CLASSIC’ or ‘NETCDF3_64BIT’.
- arm_time_variables : bool, optional
True to write the ARM standard time variables base_time and time_offset. False will not write these variables.
- arm_alt_lat_lon_variables : bool, optional
True to write the ARM standard alt, lat, lon variables. False will not write these variables.
-
class
pyart.core.
HorizontalWindProfile
(height, speed, direction, latitude=None, longitude=None)[source]¶ Bases:
object
Horizontal wind profile.
Parameters: - height : array-like, 1D
Heights in meters above sea level at which horizontal winds were sampled.
- speed : array-like, 1D
Horizontal wind speed in meters per second at each height sampled.
- direction : array-like, 1D
Horizontal wind direction in degrees at each height sampled.
Other Parameters: - latitude : array-like, 1D, optional
Latitude in degrees north at each height sampled.
- longitude : array-like, 1D, optional
Longitude in degrees east at each height sampled.
Attributes: - height : array, 1D
Heights in meters above sea level at which horizontal winds were sampled.
- speed : array, 1D
Horizontal wind speed in meters per second at each height.
- direction : array, 1D
Horizontal wind direction in degrees at each height.
u_wind
: array, 1DU component of horizontal wind in meters per second.
v_wind
: array, 1DV component of horizontal wind in meters per second.
Methods
from_u_and_v
(height, u_wind, v_wind)Create a HorizontalWindProfile instance from U and V components. -
__class__
¶ alias of
builtins.type
-
__delattr__
(self, name, /)¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'pyart.core.wind_profile', '__doc__': '\n Horizontal wind profile.\n\n Parameters\n ----------\n height : array-like, 1D\n Heights in meters above sea level at which horizontal winds were\n sampled.\n speed : array-like, 1D\n Horizontal wind speed in meters per second at each height sampled.\n direction : array-like, 1D\n Horizontal wind direction in degrees at each height sampled.\n\n Other Parameters\n ----------------\n latitude : array-like, 1D, optional\n Latitude in degrees north at each height sampled.\n longitude : array-like, 1D, optional\n Longitude in degrees east at each height sampled.\n\n Attributes\n ----------\n height : array, 1D\n Heights in meters above sea level at which horizontal winds were\n sampled.\n speed : array, 1D\n Horizontal wind speed in meters per second at each height.\n direction : array, 1D\n Horizontal wind direction in degrees at each height.\n u_wind : array, 1D\n U component of horizontal winds in meters per second at each height.\n v_wind : array, 1D\n V component of horizontal winds in meters per second at each height.\n\n ', '__init__': <function HorizontalWindProfile.__init__>, 'from_u_and_v': <classmethod object>, 'u_wind': <property object>, 'v_wind': <property object>, '_parse_location_data': <function HorizontalWindProfile._parse_location_data>, '__dict__': <attribute '__dict__' of 'HorizontalWindProfile' objects>, '__weakref__': <attribute '__weakref__' of 'HorizontalWindProfile' objects>})¶
-
__dir__
(self, /)¶ Default dir() implementation.
-
__eq__
(self, value, /)¶ Return self==value.
-
__format__
(self, format_spec, /)¶ Default object formatter.
-
__ge__
(self, value, /)¶ Return self>=value.
-
__getattribute__
(self, name, /)¶ Return getattr(self, name).
-
__gt__
(self, value, /)¶ Return self>value.
-
__hash__
(self, /)¶ Return hash(self).
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__
(self, value, /)¶ Return self<=value.
-
__lt__
(self, value, /)¶ Return self<value.
-
__module__
= 'pyart.core.wind_profile'¶
-
__ne__
(self, value, /)¶ Return self!=value.
-
__new__
(*args, **kwargs)¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
(self, /)¶ Helper for pickle.
-
__reduce_ex__
(self, protocol, /)¶ Helper for pickle.
-
__repr__
(self, /)¶ Return repr(self).
-
__setattr__
(self, name, value, /)¶ Implement setattr(self, name, value).
-
__sizeof__
(self, /)¶ Size of object in memory, in bytes.
-
__str__
(self, /)¶ Return str(self).
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)
-
classmethod
from_u_and_v
(height, u_wind, v_wind)[source]¶ Create a HorizontalWindProfile instance from U and V components.
Parameters: - height : array-like, 1D
Heights in meters above sea level at which horizontal winds were sampled.
- u_wind : array-like, 1D
U component of horizontal wind speed in meters per second.
- v_wind : array-like, 1D
V component of horizontal wind speed in meters per second.
-
u_wind
¶ U component of horizontal wind in meters per second.
-
v_wind
¶ V component of horizontal wind in meters per second.
-
class
pyart.core.
Radar
(time, _range, fields, metadata, scan_type, latitude, longitude, altitude, sweep_number, sweep_mode, fixed_angle, sweep_start_ray_index, sweep_end_ray_index, azimuth, elevation, altitude_agl=None, target_scan_rate=None, rays_are_indexed=None, ray_angle_res=None, scan_rate=None, antenna_transition=None, instrument_parameters=None, radar_calibration=None, rotation=None, tilt=None, roll=None, drift=None, heading=None, pitch=None, georefs_applied=None)[source]¶ Bases:
object
A class for storing antenna coordinate radar data.
The structure of the Radar class is based on the CF/Radial Data file format. Global attributes and variables (section 4.1 and 4.3) are represented as a dictionary in the metadata attribute. Other required and optional variables are represented as dictionaries in a attribute with the same name as the variable in the CF/Radial standard. When a optional attribute not present the attribute has a value of None. The data for a given variable is stored in the dictionary under the ‘data’ key. Moment field data is stored as a dictionary of dictionaries in the fields attribute. Sub-convention variables are stored as a dictionary of dictionaries under the meta_group attribute.
Refer to the attribute section for information on the parameters.
Attributes: - time : dict
Time at the center of each ray.
- range : dict
Range to the center of each gate (bin).
- fields : dict of dicts
Moment fields.
- metadata : dict
Metadata describing the instrument and data.
- scan_type : str
Type of scan, one of ‘ppi’, ‘rhi’, ‘sector’ or ‘other’. If the scan volume contains multiple sweep modes this should be ‘other’.
- latitude : dict
Latitude of the instrument.
- longitude : dict
Longitude of the instrument.
- altitude : dict
Altitude of the instrument, above sea level.
- altitude_agl : dict or None
Altitude of the instrument above ground level. If not provided this attribute is set to None, indicating this parameter not available.
- sweep_number : dict
The number of the sweep in the volume scan, 0-based.
- sweep_mode : dict
Sweep mode for each mode in the volume scan.
- fixed_angle : dict
Target angle for thr sweep. Azimuth angle in RHI modes, elevation angle in all other modes.
- sweep_start_ray_index : dict
Index of the first ray in each sweep relative to the start of the volume, 0-based.
- sweep_end_ray_index : dict
Index of the last ray in each sweep relative to the start of the volume, 0-based.
- rays_per_sweep : LazyLoadDict
Number of rays in each sweep. The data key of this attribute is create upon first access from the data in the sweep_start_ray_index and sweep_end_ray_index attributes. If the sweep locations needs to be modified, do this prior to accessing this attribute or use
init_rays_per_sweep()
to reset the attribute.- target_scan_rate : dict or None
Intended scan rate for each sweep. If not provided this attribute is set to None, indicating this parameter is not available.
- rays_are_indexed : dict or None
Indication of whether ray angles are indexed to a regular grid in each sweep. If not provided this attribute is set to None, indicating ray angle spacing is not determined.
- ray_angle_res : dict or None
If rays_are_indexed is not None, this provides the angular resolution of the grid. If not provided or available this attribute is set to None.
- azimuth : dict
Azimuth of antenna, relative to true North. Azimuth angles are recommended to be expressed in the range of [0, 360], but other representations are not forbidden.
- elevation : dict
Elevation of antenna, relative to the horizontal plane. Elevation angles are recommended to be expressed in the range of [-180, 180], but other representations are not forbidden.
- gate_x, gate_y, gate_z : LazyLoadDict
Location of each gate in a Cartesian coordinate system assuming a standard atmosphere with a 4/3 Earth’s radius model. The data keys of these attributes are create upon first access from the data in the range, azimuth and elevation attributes. If these attributes are changed use
init_gate_x_y_z()
to reset.- gate_longitude, gate_latitude : LazyLoadDict
Geographic location of each gate. The projection parameter(s) defined in the projection attribute are used to perform an inverse map projection from the Cartesian gate locations relative to the radar location to longitudes and latitudes. If these attributes are changed use
init_gate_longitude_latitude()
to reset the attributes.- projection : dic or str
Projection parameters defining the map projection used to transform from Cartesian to geographic coordinates. The default dictionary sets the ‘proj’ key to ‘pyart_aeqd’ indicating that the native Py-ART azimuthal equidistant projection is used. This can be modified to specify a valid pyproj.Proj projparams dictionary or string. The special key ‘_include_lon_0_lat_0’ is removed when interpreting this dictionary. If this key is present and set to True, which is required when proj=’pyart_aeqd’, then the radar longitude and latitude will be added to the dictionary as ‘lon_0’ and ‘lat_0’.
- gate_altitude : LazyLoadDict
The altitude of each radar gate as calculated from the altitude of the radar and the Cartesian z location of each gate. If this attribute is changed use
init_gate_altitude()
to reset the attribute.- scan_rate : dict or None
Actual antenna scan rate. If not provided this attribute is set to None, indicating this parameter is not available.
- antenna_transition : dict or None
Flag indicating if the antenna is in transition, 1 = yes, 0 = no. If not provided this attribute is set to None, indicating this parameter is not available.
- rotation : dict or None
The rotation angle of the antenna. The angle about the aircraft longitudinal axis for a vertically scanning radar.
- tilt : dict or None
The tilt angle with respect to the plane orthogonal (Z-axis) to aircraft longitudinal axis.
- roll : dict or None
The roll angle of platform, for aircraft right wing down is positive.
- drift : dict or None
Drift angle of antenna, the angle between heading and track.
- heading : dict or None
Heading (compass) angle, clockwise from north.
- pitch : dict or None
Pitch angle of antenna, for aircraft nose up is positive.
- georefs_applied : dict or None
Indicates whether the variables have had georeference calculation applied. Leading to Earth-centric azimuth and elevation angles.
- instrument_parameters : dict of dicts or None
Instrument parameters, if not provided this attribute is set to None, indicating these parameters are not avaiable. This dictionary also includes variables in the radar_parameters CF/Radial subconvention.
- radar_calibration : dict of dicts or None
Instrument calibration parameters. If not provided this attribute is set to None, indicating these parameters are not available
- ngates : int
Number of gates (bins) in a ray.
- nrays : int
Number of rays in the volume.
- nsweeps : int
Number of sweep in the volume.
Methods
add_field
(self, field_name, dic[, …])Add a field to the object. add_field_like
(self, existing_field_name, …)Add a field to the object with metadata from a existing field. check_field_exists
(self, field_name)Check that a field exists in the fields dictionary. extract_sweeps
(self, sweeps)Create a new radar contains only the data from select sweeps. get_azimuth
(self, sweep[, copy])Return an array of azimuth angles for a given sweep. get_elevation
(self, sweep[, copy])Return an array of elevation angles for a given sweep. get_end
(self, sweep)Return the ending ray for a given sweep. get_field
(self, sweep, field_name[, copy])Return the field data for a given sweep. get_gate_lat_lon_alt
(self, sweep[, …])Return the longitude, latitude and altitude gate locations. get_gate_x_y_z
(self, sweep[, edges, …])Return the x, y and z gate locations in meters for a given sweep. get_nyquist_vel
(self, sweep[, check_uniform])Return the Nyquist velocity in meters per second for a given sweep. get_slice
(self, sweep)Return a slice for selecting rays for a given sweep. get_start
(self, sweep)Return the starting ray index for a given sweep. get_start_end
(self, sweep)Return the starting and ending ray for a given sweep. info
(self[, level, out])Print information on radar. init_gate_altitude
(self)Initialize the gate_altitude attribute. init_gate_longitude_latitude
(self)Initialize or reset the gate_longitude and gate_latitude attributes. init_gate_x_y_z
(self)Initialize or reset the gate_{x, y, z} attributes. init_rays_per_sweep
(self)Initialize or reset the rays_per_sweep attribute. iter_azimuth
(self)Return an iterator which returns sweep azimuth data. iter_elevation
(self)Return an iterator which returns sweep elevation data. iter_end
(self)Return an iterator over the sweep end indices. iter_field
(self, field_name)Return an iterator which returns sweep field data. iter_slice
(self)Return an iterator which returns sweep slice objects. iter_start
(self)Return an iterator over the sweep start indices. iter_start_end
(self)Return an iterator over the sweep start and end indices. -
__class__
¶ alias of
builtins.type
-
__delattr__
(self, name, /)¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'pyart.core.radar', '__doc__': "\n A class for storing antenna coordinate radar data.\n\n The structure of the Radar class is based on the CF/Radial Data file\n format. Global attributes and variables (section 4.1 and 4.3) are\n represented as a dictionary in the metadata attribute. Other required and\n optional variables are represented as dictionaries in a attribute with the\n same name as the variable in the CF/Radial standard. When a optional\n attribute not present the attribute has a value of None. The data for a\n given variable is stored in the dictionary under the 'data' key. Moment\n field data is stored as a dictionary of dictionaries in the fields\n attribute. Sub-convention variables are stored as a dictionary of\n dictionaries under the meta_group attribute.\n\n Refer to the attribute section for information on the parameters.\n\n Attributes\n ----------\n time : dict\n Time at the center of each ray.\n range : dict\n Range to the center of each gate (bin).\n fields : dict of dicts\n Moment fields.\n metadata : dict\n Metadata describing the instrument and data.\n scan_type : str\n Type of scan, one of 'ppi', 'rhi', 'sector' or 'other'. If the scan\n volume contains multiple sweep modes this should be 'other'.\n latitude : dict\n Latitude of the instrument.\n longitude : dict\n Longitude of the instrument.\n altitude : dict\n Altitude of the instrument, above sea level.\n altitude_agl : dict or None\n Altitude of the instrument above ground level. If not provided this\n attribute is set to None, indicating this parameter not available.\n sweep_number : dict\n The number of the sweep in the volume scan, 0-based.\n sweep_mode : dict\n Sweep mode for each mode in the volume scan.\n fixed_angle : dict\n Target angle for thr sweep. Azimuth angle in RHI modes, elevation\n angle in all other modes.\n sweep_start_ray_index : dict\n Index of the first ray in each sweep relative to the start of the\n volume, 0-based.\n sweep_end_ray_index : dict\n Index of the last ray in each sweep relative to the start of the\n volume, 0-based.\n rays_per_sweep : LazyLoadDict\n Number of rays in each sweep. The data key of this attribute is\n create upon first access from the data in the sweep_start_ray_index and\n sweep_end_ray_index attributes. If the sweep locations needs to be\n modified, do this prior to accessing this attribute or use\n :py:func:`init_rays_per_sweep` to reset the attribute.\n target_scan_rate : dict or None\n Intended scan rate for each sweep. If not provided this attribute is\n set to None, indicating this parameter is not available.\n rays_are_indexed : dict or None\n Indication of whether ray angles are indexed to a regular grid in\n each sweep. If not provided this attribute is set to None, indicating\n ray angle spacing is not determined.\n ray_angle_res : dict or None\n If rays_are_indexed is not None, this provides the angular resolution\n of the grid. If not provided or available this attribute is set to\n None.\n azimuth : dict\n Azimuth of antenna, relative to true North. Azimuth angles are\n recommended to be expressed in the range of [0, 360], but other\n representations are not forbidden.\n elevation : dict\n Elevation of antenna, relative to the horizontal plane. Elevation\n angles are recommended to be expressed in the range of [-180, 180],\n but other representations are not forbidden.\n gate_x, gate_y, gate_z : LazyLoadDict\n Location of each gate in a Cartesian coordinate system assuming a\n standard atmosphere with a 4/3 Earth's radius model. The data keys of\n these attributes are create upon first access from the data in the\n range, azimuth and elevation attributes. If these attributes are\n changed use :py:func:`init_gate_x_y_z` to reset.\n gate_longitude, gate_latitude : LazyLoadDict\n Geographic location of each gate. The projection parameter(s) defined\n in the `projection` attribute are used to perform an inverse map\n projection from the Cartesian gate locations relative to the radar\n location to longitudes and latitudes. If these attributes are changed\n use :py:func:`init_gate_longitude_latitude` to reset the attributes.\n projection : dic or str\n Projection parameters defining the map projection used to transform\n from Cartesian to geographic coordinates. The default dictionary sets\n the 'proj' key to 'pyart_aeqd' indicating that the native Py-ART\n azimuthal equidistant projection is used. This can be modified to\n specify a valid pyproj.Proj projparams dictionary or string.\n The special key '_include_lon_0_lat_0' is removed when interpreting\n this dictionary. If this key is present and set to True, which is\n required when proj='pyart_aeqd', then the radar longitude and\n latitude will be added to the dictionary as 'lon_0' and 'lat_0'.\n gate_altitude : LazyLoadDict\n The altitude of each radar gate as calculated from the altitude of the\n radar and the Cartesian z location of each gate. If this attribute\n is changed use :py:func:`init_gate_altitude` to reset the attribute.\n scan_rate : dict or None\n Actual antenna scan rate. If not provided this attribute is set to\n None, indicating this parameter is not available.\n antenna_transition : dict or None\n Flag indicating if the antenna is in transition, 1 = yes, 0 = no.\n If not provided this attribute is set to None, indicating this\n parameter is not available.\n rotation : dict or None\n The rotation angle of the antenna. The angle about the aircraft\n longitudinal axis for a vertically scanning radar.\n tilt : dict or None\n The tilt angle with respect to the plane orthogonal (Z-axis) to\n aircraft longitudinal axis.\n roll : dict or None\n The roll angle of platform, for aircraft right wing down is positive.\n drift : dict or None\n Drift angle of antenna, the angle between heading and track.\n heading : dict or None\n Heading (compass) angle, clockwise from north.\n pitch : dict or None\n Pitch angle of antenna, for aircraft nose up is positive.\n georefs_applied : dict or None\n Indicates whether the variables have had georeference calculation\n applied. Leading to Earth-centric azimuth and elevation angles.\n instrument_parameters : dict of dicts or None\n Instrument parameters, if not provided this attribute is set to None,\n indicating these parameters are not avaiable. This dictionary also\n includes variables in the radar_parameters CF/Radial subconvention.\n radar_calibration : dict of dicts or None\n Instrument calibration parameters. If not provided this attribute is\n set to None, indicating these parameters are not available\n ngates : int\n Number of gates (bins) in a ray.\n nrays : int\n Number of rays in the volume.\n nsweeps : int\n Number of sweep in the volume.\n\n ", '__init__': <function Radar.__init__>, '__getstate__': <function Radar.__getstate__>, '__setstate__': <function Radar.__setstate__>, 'init_rays_per_sweep': <function Radar.init_rays_per_sweep>, 'init_gate_x_y_z': <function Radar.init_gate_x_y_z>, 'init_gate_longitude_latitude': <function Radar.init_gate_longitude_latitude>, 'init_gate_altitude': <function Radar.init_gate_altitude>, '_check_sweep_in_range': <function Radar._check_sweep_in_range>, 'check_field_exists': <function Radar.check_field_exists>, 'iter_start': <function Radar.iter_start>, 'iter_end': <function Radar.iter_end>, 'iter_start_end': <function Radar.iter_start_end>, 'iter_slice': <function Radar.iter_slice>, 'iter_field': <function Radar.iter_field>, 'iter_azimuth': <function Radar.iter_azimuth>, 'iter_elevation': <function Radar.iter_elevation>, 'get_start': <function Radar.get_start>, 'get_end': <function Radar.get_end>, 'get_start_end': <function Radar.get_start_end>, 'get_slice': <function Radar.get_slice>, 'get_field': <function Radar.get_field>, 'get_azimuth': <function Radar.get_azimuth>, 'get_elevation': <function Radar.get_elevation>, 'get_gate_x_y_z': <function Radar.get_gate_x_y_z>, 'get_gate_lat_lon_alt': <function Radar.get_gate_lat_lon_alt>, 'get_nyquist_vel': <function Radar.get_nyquist_vel>, 'info': <function Radar.info>, '_dic_info': <function Radar._dic_info>, 'add_field': <function Radar.add_field>, 'add_field_like': <function Radar.add_field_like>, 'extract_sweeps': <function Radar.extract_sweeps>, '__dict__': <attribute '__dict__' of 'Radar' objects>, '__weakref__': <attribute '__weakref__' of 'Radar' objects>})¶
-
__dir__
(self, /)¶ Default dir() implementation.
-
__eq__
(self, value, /)¶ Return self==value.
-
__format__
(self, format_spec, /)¶ Default object formatter.
-
__ge__
(self, value, /)¶ Return self>=value.
-
__getattribute__
(self, name, /)¶ Return getattr(self, name).
-
__gt__
(self, value, /)¶ Return self>value.
-
__hash__
(self, /)¶ Return hash(self).
-
__init__
(self, time, _range, fields, metadata, scan_type, latitude, longitude, altitude, sweep_number, sweep_mode, fixed_angle, sweep_start_ray_index, sweep_end_ray_index, azimuth, elevation, altitude_agl=None, target_scan_rate=None, rays_are_indexed=None, ray_angle_res=None, scan_rate=None, antenna_transition=None, instrument_parameters=None, radar_calibration=None, rotation=None, tilt=None, roll=None, drift=None, heading=None, pitch=None, georefs_applied=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__
(self, value, /)¶ Return self<=value.
-
__lt__
(self, value, /)¶ Return self<value.
-
__module__
= 'pyart.core.radar'¶
-
__ne__
(self, value, /)¶ Return self!=value.
-
__new__
(*args, **kwargs)¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
(self, /)¶ Helper for pickle.
-
__reduce_ex__
(self, protocol, /)¶ Helper for pickle.
-
__repr__
(self, /)¶ Return repr(self).
-
__setattr__
(self, name, value, /)¶ Implement setattr(self, name, value).
-
__sizeof__
(self, /)¶ Size of object in memory, in bytes.
-
__str__
(self, /)¶ Return str(self).
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)
-
_dic_info
(self, attr, level, out, dic=None, ident_level=0)[source]¶ Print information on a dictionary attribute.
-
add_field
(self, field_name, dic, replace_existing=False)[source]¶ Add a field to the object.
Parameters: - field_name : str
Name of the field to add to the dictionary of fields.
- dic : dict
Dictionary contain field data and metadata.
- replace_existing : bool, optional
True to replace the existing field with key field_name if it exists, loosing any existing data. False will raise a ValueError when the field already exists.
-
add_field_like
(self, existing_field_name, field_name, data, replace_existing=False)[source]¶ Add a field to the object with metadata from a existing field.
Note that the data parameter is not copied by this method. If data refers to a ‘data’ array from an existing field dictionary, a copy should be made within or prior to using this method. If this is not done the ‘data’ key in both field dictionaries will point to the same NumPy array and modification of one will change the second. To copy NumPy arrays use the copy() method. See the Examples section for how to create a copy of the ‘reflectivity’ field as a field named ‘reflectivity_copy’.
Parameters: - existing_field_name : str
Name of an existing field to take metadata from when adding the new field to the object.
- field_name : str
Name of the field to add to the dictionary of fields.
- data : array
Field data. A copy of this data is not made, see the note above.
- replace_existing : bool, optional
True to replace the existing field with key field_name if it exists, loosing any existing data. False will raise a ValueError when the field already exists.
Examples
>>> radar.add_field_like('reflectivity', 'reflectivity_copy', ... radar.fields['reflectivity']['data'].copy())
-
check_field_exists
(self, field_name)[source]¶ Check that a field exists in the fields dictionary.
If the field does not exist raise a KeyError.
Parameters: - field_name : str
Name of field to check.
-
extract_sweeps
(self, sweeps)[source]¶ Create a new radar contains only the data from select sweeps.
Parameters: - sweeps : array_like
Sweeps (0-based) to include in new Radar object.
Returns: - radar : Radar
Radar object which contains a copy of data from the selected sweeps.
-
get_azimuth
(self, sweep, copy=False)[source]¶ Return an array of azimuth angles for a given sweep.
Parameters: - sweep : int
Sweep number to retrieve data for, 0 based.
- copy : bool, optional
True to return a copy of the azimuths. False, the default, returns a view of the azimuths (when possible), changing this data will change the data in the underlying Radar object.
Returns: - azimuths : array
Array containing the azimuth angles for a given sweep.
-
get_elevation
(self, sweep, copy=False)[source]¶ Return an array of elevation angles for a given sweep.
Parameters: - sweep : int
Sweep number to retrieve data for, 0 based.
- copy : bool, optional
True to return a copy of the elevations. False, the default, returns a view of the elevations (when possible), changing this data will change the data in the underlying Radar object.
Returns: - azimuths : array
Array containing the elevation angles for a given sweep.
-
get_field
(self, sweep, field_name, copy=False)[source]¶ Return the field data for a given sweep.
When used with
get_gate_x_y_z()
this method can be used to obtain the data needed for plotting a radar field with the correct spatial context.Parameters: - sweep : int
Sweep number to retrieve data for, 0 based.
- field_name : str
Name of the field from which data should be retrieved.
- copy : bool, optional
True to return a copy of the data. False, the default, returns a view of the data (when possible), changing this data will change the data in the underlying Radar object.
Returns: - data : array
Array containing data for the requested sweep and field.
-
get_gate_lat_lon_alt
(self, sweep, reset_gate_coords=False, filter_transitions=False)[source]¶ Return the longitude, latitude and altitude gate locations. Longitude and latitude are in degrees and altitude in meters.
With the default parameter this method returns the same data as contained in the gate_latitude, gate_longitude and gate_altitude attributes but this method performs the gate location calculations only for the specified sweep and therefore is more efficient than accessing this data through these attribute. If coordinates have at all, please use the reset_gate_coords parameter.
Parameters: - sweep : int
Sweep number to retrieve gate locations from, 0 based.
- reset_gate_coords : bool, optional
Optional to reset the gate latitude, gate longitude and gate altitude attributes before using them in this function. This is useful when the geographic coordinates have changed and gate latitude, gate longitude and gate altitude need to be reset.
- filter_transitions : bool, optional
True to remove rays where the antenna was in transition between sweeps. False will include these rays. No rays will be removed if the antenna_transition attribute is not available (set to None).
Returns: - lat, lon, alt : 2D array
Array containing the latitude, longitude and altitude, for all gates in the sweep.
-
get_gate_x_y_z
(self, sweep, edges=False, filter_transitions=False)[source]¶ Return the x, y and z gate locations in meters for a given sweep.
With the default parameter this method returns the same data as contained in the gate_x, gate_y and gate_z attributes but this method performs the gate location calculations only for the specified sweep and therefore is more efficient than accessing this data through these attribute.
When used with
get_field()
this method can be used to obtain the data needed for plotting a radar field with the correct spatial context.Parameters: - sweep : int
Sweep number to retrieve gate locations from, 0 based.
- edges : bool, optional
True to return the locations of the gate edges calculated by interpolating between the range, azimuths and elevations. False (the default) will return the locations of the gate centers with no interpolation.
- filter_transitions : bool, optional
True to remove rays where the antenna was in transition between sweeps. False will include these rays. No rays will be removed if the antenna_transition attribute is not available (set to None).
Returns: - x, y, z : 2D array
Array containing the x, y and z, distances from the radar in meters for the center (or edges) for all gates in the sweep.
-
get_nyquist_vel
(self, sweep, check_uniform=True)[source]¶ Return the Nyquist velocity in meters per second for a given sweep.
Raises a LookupError if the Nyquist velocity is not available, an Exception is raised if the velocities are not uniform in the sweep unless check_uniform is set to False.
Parameters: - sweep : int
Sweep number to retrieve data for, 0 based.
- check_uniform : bool
True to check to perform a check on the Nyquist velocities that they are uniform in the sweep, False will skip this check and return the velocity of the first ray in the sweep.
Returns: - nyquist_velocity : float
Array containing the Nyquist velocity in m/s for a given sweep.
-
info
(self, level='standard', out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]¶ Print information on radar.
Parameters: - level : {‘compact’, ‘standard’, ‘full’, ‘c’, ‘s’, ‘f’}, optional
Level of information on radar object to print, compact is minimal information, standard more and full everything.
- out : file-like, optional
Stream to direct output to, default is to print information to standard out (the screen).
-
class
pyart.core.
RadarSpectra
(time, _range, fields, metadata, scan_type, latitude, longitude, altitude, sweep_number, sweep_mode, fixed_angle, sweep_start_ray_index, sweep_end_ray_index, azimuth, elevation, npulses, Doppler_velocity=None, Doppler_frequency=None, altitude_agl=None, target_scan_rate=None, rays_are_indexed=None, ray_angle_res=None, scan_rate=None, antenna_transition=None, instrument_parameters=None, radar_calibration=None, rotation=None, tilt=None, roll=None, drift=None, heading=None, pitch=None, georefs_applied=None)[source]¶ Bases:
pyart.core.radar.Radar
A class for storing antenna coordinate radar spectra data. Based on the radar object class
The structure of the Radar class is based on the CF/Radial Data file format. Global attributes and variables (section 4.1 and 4.3) are represented as a dictionary in the metadata attribute. Other required and optional variables are represented as dictionaries in a attribute with the same name as the variable in the CF/Radial standard. When a optional attribute not present the attribute has a value of None. The data for a given variable is stored in the dictionary under the ‘data’ key. Moment field data is stored as a dictionary of dictionaries in the fields attribute. Sub-convention variables are stored as a dictionary of dictionaries under the meta_group attribute.
Refer to the attribute section for information on the parameters.
Attributes: - time : dict
Time at the center of each ray.
- range : dict
Range to the center of each gate (bin).
- npulses : dict
number of pulses for each ray
- Doppler_velocity : dict or None
The Doppler velocity of each Doppler bin. The data has dimensions nrays x npulses_max
- Doppler_frequency : dict or None
The Doppler frequency of each Doppler bin. The data has dimensions nrays x npulses_max
- fields : dict of dicts
Moment fields. The data has dimensions nrays x ngates x npulses_max
- metadata : dict
Metadata describing the instrument and data.
- scan_type : str
Type of scan, one of ‘ppi’, ‘rhi’, ‘sector’ or ‘other’. If the scan volume contains multiple sweep modes this should be ‘other’.
- latitude : dict
Latitude of the instrument.
- longitude : dict
Longitude of the instrument.
- altitude : dict
Altitude of the instrument, above sea level.
- altitude_agl : dict or None
Altitude of the instrument above ground level. If not provided this attribute is set to None, indicating this parameter not available.
- sweep_number : dict
The number of the sweep in the volume scan, 0-based.
- sweep_mode : dict
Sweep mode for each mode in the volume scan.
- fixed_angle : dict
Target angle for thr sweep. Azimuth angle in RHI modes, elevation angle in all other modes.
- sweep_start_ray_index : dict
Index of the first ray in each sweep relative to the start of the volume, 0-based.
- sweep_end_ray_index : dict
Index of the last ray in each sweep relative to the start of the volume, 0-based.
- rays_per_sweep : LazyLoadDict
Number of rays in each sweep. The data key of this attribute is create upon first access from the data in the sweep_start_ray_index and sweep_end_ray_index attributes. If the sweep locations needs to be modified, do this prior to accessing this attribute or use
init_rays_per_sweep()
to reset the attribute.- target_scan_rate : dict or None
Intended scan rate for each sweep. If not provided this attribute is set to None, indicating this parameter is not available.
- rays_are_indexed : dict or None
Indication of whether ray angles are indexed to a regular grid in each sweep. If not provided this attribute is set to None, indicating ray angle spacing is not determined.
- ray_angle_res : dict or None
If rays_are_indexed is not None, this provides the angular resolution of the grid. If not provided or available this attribute is set to None.
- azimuth : dict
Azimuth of antenna, relative to true North. Azimuth angles are recommended to be expressed in the range of [0, 360], but other representations are not forbidden.
- elevation : dict
Elevation of antenna, relative to the horizontal plane. Elevation angles are recommended to be expressed in the range of [-180, 180], but other representations are not forbidden.
- gate_x, gate_y, gate_z : LazyLoadDict
Location of each gate in a Cartesian coordinate system assuming a standard atmosphere with a 4/3 Earth’s radius model. The data keys of these attributes are create upon first access from the data in the range, azimuth and elevation attributes. If these attributes are changed use
init_gate_x_y_z()
to reset.- gate_longitude, gate_latitude : LazyLoadDict
Geographic location of each gate. The projection parameter(s) defined in the projection attribute are used to perform an inverse map projection from the Cartesian gate locations relative to the radar location to longitudes and latitudes. If these attributes are changed use
init_gate_longitude_latitude()
to reset the attributes.- projection : dic or str
Projection parameters defining the map projection used to transform from Cartesian to geographic coordinates. The default dictionary sets the ‘proj’ key to ‘pyart_aeqd’ indicating that the native Py-ART azimuthal equidistant projection is used. This can be modified to specify a valid pyproj.Proj projparams dictionary or string. The special key ‘_include_lon_0_lat_0’ is removed when interpreting this dictionary. If this key is present and set to True, which is required when proj=’pyart_aeqd’, then the radar longitude and latitude will be added to the dictionary as ‘lon_0’ and ‘lat_0’.
- gate_altitude : LazyLoadDict
The altitude of each radar gate as calculated from the altitude of the radar and the Cartesian z location of each gate. If this attribute is changed use
init_gate_altitude()
to reset the attribute.- scan_rate : dict or None
Actual antenna scan rate. If not provided this attribute is set to None, indicating this parameter is not available.
- antenna_transition : dict or None
Flag indicating if the antenna is in transition, 1 = yes, 0 = no. If not provided this attribute is set to None, indicating this parameter is not available.
- rotation : dict or None
The rotation angle of the antenna. The angle about the aircraft longitudinal axis for a vertically scanning radar.
- tilt : dict or None
The tilt angle with respect to the plane orthogonal (Z-axis) to aircraft longitudinal axis.
- roll : dict or None
The roll angle of platform, for aircraft right wing down is positive.
- drift : dict or None
Drift angle of antenna, the angle between heading and track.
- heading : dict or None
Heading (compass) angle, clockwise from north.
- pitch : dict or None
Pitch angle of antenna, for aircraft nose up is positive.
- georefs_applied : dict or None
Indicates whether the variables have had georeference calculation applied. Leading to Earth-centric azimuth and elevation angles.
- instrument_parameters : dict of dicts or None
Instrument parameters, if not provided this attribute is set to None, indicating these parameters are not avaiable. This dictionary also includes variables in the radar_parameters CF/Radial subconvention.
- radar_calibration : dict of dicts or None
Instrument calibration parameters. If not provided this attribute is set to None, indicating these parameters are not available
- ngates : int
Number of gates (bins) in a ray.
- nrays : int
Number of rays in the volume.
- npulses_max : int
Maximum number of pulses per ray in the volume.
- nsweeps : int
Number of sweep in the volume.
Methods
add_field
(self, field_name, dic[, …])Add a field to the object. add_field_like
(self, existing_field_name, …)Add a field to the object with metadata from a existing field. check_field_exists
(self, field_name)Check that a field exists in the fields dictionary. extract_sweeps
(self, sweeps)Create a new radar contains only the data from select sweeps. get_azimuth
(self, sweep[, copy])Return an array of azimuth angles for a given sweep. get_elevation
(self, sweep[, copy])Return an array of elevation angles for a given sweep. get_end
(self, sweep)Return the ending ray for a given sweep. get_field
(self, sweep, field_name[, copy])Return the field data for a given sweep. get_gate_lat_lon_alt
(self, sweep[, …])Return the longitude, latitude and altitude gate locations. get_gate_x_y_z
(self, sweep[, edges, …])Return the x, y and z gate locations in meters for a given sweep. get_nyquist_vel
(self, sweep[, check_uniform])Return the Nyquist velocity in meters per second for a given sweep. get_slice
(self, sweep)Return a slice for selecting rays for a given sweep. get_start
(self, sweep)Return the starting ray index for a given sweep. get_start_end
(self, sweep)Return the starting and ending ray for a given sweep. info
(self[, level, out])Print information on radar. init_gate_altitude
(self)Initialize the gate_altitude attribute. init_gate_longitude_latitude
(self)Initialize or reset the gate_longitude and gate_latitude attributes. init_gate_x_y_z
(self)Initialize or reset the gate_{x, y, z} attributes. init_rays_per_sweep
(self)Initialize or reset the rays_per_sweep attribute. iter_azimuth
(self)Return an iterator which returns sweep azimuth data. iter_elevation
(self)Return an iterator which returns sweep elevation data. iter_end
(self)Return an iterator over the sweep end indices. iter_field
(self, field_name)Return an iterator which returns sweep field data. iter_slice
(self)Return an iterator which returns sweep slice objects. iter_start
(self)Return an iterator over the sweep start indices. iter_start_end
(self)Return an iterator over the sweep start and end indices. -
__class__
¶ alias of
builtins.type
-
__delattr__
(self, name, /)¶ Implement delattr(self, name).
-
__dict__
= mappingproxy({'__module__': 'pyart.core.radar_spectra', '__doc__': "\n A class for storing antenna coordinate radar spectra data. Based on the\n radar object class\n\n The structure of the Radar class is based on the CF/Radial Data file\n format. Global attributes and variables (section 4.1 and 4.3) are\n represented as a dictionary in the metadata attribute. Other required and\n optional variables are represented as dictionaries in a attribute with the\n same name as the variable in the CF/Radial standard. When a optional\n attribute not present the attribute has a value of None. The data for a\n given variable is stored in the dictionary under the 'data' key. Moment\n field data is stored as a dictionary of dictionaries in the fields\n attribute. Sub-convention variables are stored as a dictionary of\n dictionaries under the meta_group attribute.\n\n Refer to the attribute section for information on the parameters.\n\n Attributes\n ----------\n time : dict\n Time at the center of each ray.\n range : dict\n Range to the center of each gate (bin).\n npulses : dict\n number of pulses for each ray\n Doppler_velocity : dict or None\n The Doppler velocity of each Doppler bin. The data has dimensions\n nrays x npulses_max\n Doppler_frequency : dict or None\n The Doppler frequency of each Doppler bin. The data has dimensions\n nrays x npulses_max\n fields : dict of dicts\n Moment fields. The data has dimensions nrays x ngates x npulses_max\n metadata : dict\n Metadata describing the instrument and data.\n scan_type : str\n Type of scan, one of 'ppi', 'rhi', 'sector' or 'other'. If the scan\n volume contains multiple sweep modes this should be 'other'.\n latitude : dict\n Latitude of the instrument.\n longitude : dict\n Longitude of the instrument.\n altitude : dict\n Altitude of the instrument, above sea level.\n altitude_agl : dict or None\n Altitude of the instrument above ground level. If not provided this\n attribute is set to None, indicating this parameter not available.\n sweep_number : dict\n The number of the sweep in the volume scan, 0-based.\n sweep_mode : dict\n Sweep mode for each mode in the volume scan.\n fixed_angle : dict\n Target angle for thr sweep. Azimuth angle in RHI modes, elevation\n angle in all other modes.\n sweep_start_ray_index : dict\n Index of the first ray in each sweep relative to the start of the\n volume, 0-based.\n sweep_end_ray_index : dict\n Index of the last ray in each sweep relative to the start of the\n volume, 0-based.\n rays_per_sweep : LazyLoadDict\n Number of rays in each sweep. The data key of this attribute is\n create upon first access from the data in the sweep_start_ray_index and\n sweep_end_ray_index attributes. If the sweep locations needs to be\n modified, do this prior to accessing this attribute or use\n :py:func:`init_rays_per_sweep` to reset the attribute.\n target_scan_rate : dict or None\n Intended scan rate for each sweep. If not provided this attribute is\n set to None, indicating this parameter is not available.\n rays_are_indexed : dict or None\n Indication of whether ray angles are indexed to a regular grid in\n each sweep. If not provided this attribute is set to None, indicating\n ray angle spacing is not determined.\n ray_angle_res : dict or None\n If rays_are_indexed is not None, this provides the angular resolution\n of the grid. If not provided or available this attribute is set to\n None.\n azimuth : dict\n Azimuth of antenna, relative to true North. Azimuth angles are\n recommended to be expressed in the range of [0, 360], but other\n representations are not forbidden.\n elevation : dict\n Elevation of antenna, relative to the horizontal plane. Elevation\n angles are recommended to be expressed in the range of [-180, 180],\n but other representations are not forbidden.\n gate_x, gate_y, gate_z : LazyLoadDict\n Location of each gate in a Cartesian coordinate system assuming a\n standard atmosphere with a 4/3 Earth's radius model. The data keys of\n these attributes are create upon first access from the data in the\n range, azimuth and elevation attributes. If these attributes are\n changed use :py:func:`init_gate_x_y_z` to reset.\n gate_longitude, gate_latitude : LazyLoadDict\n Geographic location of each gate. The projection parameter(s) defined\n in the `projection` attribute are used to perform an inverse map\n projection from the Cartesian gate locations relative to the radar\n location to longitudes and latitudes. If these attributes are changed\n use :py:func:`init_gate_longitude_latitude` to reset the attributes.\n projection : dic or str\n Projection parameters defining the map projection used to transform\n from Cartesian to geographic coordinates. The default dictionary sets\n the 'proj' key to 'pyart_aeqd' indicating that the native Py-ART\n azimuthal equidistant projection is used. This can be modified to\n specify a valid pyproj.Proj projparams dictionary or string.\n The special key '_include_lon_0_lat_0' is removed when interpreting\n this dictionary. If this key is present and set to True, which is\n required when proj='pyart_aeqd', then the radar longitude and\n latitude will be added to the dictionary as 'lon_0' and 'lat_0'.\n gate_altitude : LazyLoadDict\n The altitude of each radar gate as calculated from the altitude of the\n radar and the Cartesian z location of each gate. If this attribute\n is changed use :py:func:`init_gate_altitude` to reset the attribute.\n scan_rate : dict or None\n Actual antenna scan rate. If not provided this attribute is set to\n None, indicating this parameter is not available.\n antenna_transition : dict or None\n Flag indicating if the antenna is in transition, 1 = yes, 0 = no.\n If not provided this attribute is set to None, indicating this\n parameter is not available.\n rotation : dict or None\n The rotation angle of the antenna. The angle about the aircraft\n longitudinal axis for a vertically scanning radar.\n tilt : dict or None\n The tilt angle with respect to the plane orthogonal (Z-axis) to\n aircraft longitudinal axis.\n roll : dict or None\n The roll angle of platform, for aircraft right wing down is positive.\n drift : dict or None\n Drift angle of antenna, the angle between heading and track.\n heading : dict or None\n Heading (compass) angle, clockwise from north.\n pitch : dict or None\n Pitch angle of antenna, for aircraft nose up is positive.\n georefs_applied : dict or None\n Indicates whether the variables have had georeference calculation\n applied. Leading to Earth-centric azimuth and elevation angles.\n instrument_parameters : dict of dicts or None\n Instrument parameters, if not provided this attribute is set to None,\n indicating these parameters are not avaiable. This dictionary also\n includes variables in the radar_parameters CF/Radial subconvention.\n radar_calibration : dict of dicts or None\n Instrument calibration parameters. If not provided this attribute is\n set to None, indicating these parameters are not available\n ngates : int\n Number of gates (bins) in a ray.\n nrays : int\n Number of rays in the volume.\n npulses_max : int\n Maximum number of pulses per ray in the volume.\n nsweeps : int\n Number of sweep in the volume.\n\n ", '__init__': <function RadarSpectra.__init__>, 'add_field': <function RadarSpectra.add_field>, 'add_field_like': <function RadarSpectra.add_field_like>, 'extract_sweeps': <function RadarSpectra.extract_sweeps>, 'info': <function RadarSpectra.info>})¶
-
__dir__
(self, /)¶ Default dir() implementation.
-
__eq__
(self, value, /)¶ Return self==value.
-
__format__
(self, format_spec, /)¶ Default object formatter.
-
__ge__
(self, value, /)¶ Return self>=value.
-
__getattribute__
(self, name, /)¶ Return getattr(self, name).
-
__getstate__
(self)¶ Return object’s state which can be pickled.
-
__gt__
(self, value, /)¶ Return self>value.
-
__hash__
(self, /)¶ Return hash(self).
-
__init__
(self, time, _range, fields, metadata, scan_type, latitude, longitude, altitude, sweep_number, sweep_mode, fixed_angle, sweep_start_ray_index, sweep_end_ray_index, azimuth, elevation, npulses, Doppler_velocity=None, Doppler_frequency=None, altitude_agl=None, target_scan_rate=None, rays_are_indexed=None, ray_angle_res=None, scan_rate=None, antenna_transition=None, instrument_parameters=None, radar_calibration=None, rotation=None, tilt=None, roll=None, drift=None, heading=None, pitch=None, georefs_applied=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
__init_subclass__
()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__
(self, value, /)¶ Return self<=value.
-
__lt__
(self, value, /)¶ Return self<value.
-
__module__
= 'pyart.core.radar_spectra'¶
-
__ne__
(self, value, /)¶ Return self!=value.
-
__new__
(*args, **kwargs)¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__
(self, /)¶ Helper for pickle.
-
__reduce_ex__
(self, protocol, /)¶ Helper for pickle.
-
__repr__
(self, /)¶ Return repr(self).
-
__setattr__
(self, name, value, /)¶ Implement setattr(self, name, value).
-
__setstate__
(self, state)¶ Restore unpicklable entries from pickled object.
-
__sizeof__
(self, /)¶ Size of object in memory, in bytes.
-
__str__
(self, /)¶ Return str(self).
-
__subclasshook__
()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__
¶ list of weak references to the object (if defined)
-
_check_sweep_in_range
(self, sweep)¶ Check that a sweep number is in range.
-
_dic_info
(self, attr, level, out, dic=None, ident_level=0)¶ Print information on a dictionary attribute.
-
add_field
(self, field_name, dic, replace_existing=False)[source]¶ Add a field to the object.
Parameters: - field_name : str
Name of the field to add to the dictionary of fields.
- dic : dict
Dictionary contain field data and metadata.
- replace_existing : bool
True to replace the existing field with key field_name if it exists, loosing any existing data. False will raise a ValueError when the field already exists.
-
add_field_like
(self, existing_field_name, field_name, data, replace_existing=False)[source]¶ Add a field to the object with metadata from a existing field.
Note that the data parameter is not copied by this method. If data refers to a ‘data’ array from an existing field dictionary, a copy should be made within or prior to using this method. If this is not done the ‘data’ key in both field dictionaries will point to the same NumPy array and modification of one will change the second. To copy NumPy arrays use the copy() method. See the Examples section for how to create a copy of the ‘reflectivity’ field as a field named ‘reflectivity_copy’.
Parameters: - existing_field_name : str
Name of an existing field to take metadata from when adding the new field to the object.
- field_name : str
Name of the field to add to the dictionary of fields.
- data : array
Field data. A copy of this data is not made, see the note above.
- replace_existing : bool
True to replace the existing field with key field_name if it exists, loosing any existing data. False will raise a ValueError when the field already exists.
Examples
>>> radar.add_field_like('reflectivity', 'reflectivity_copy', ... radar.fields['reflectivity']['data'].copy())
-
check_field_exists
(self, field_name)¶ Check that a field exists in the fields dictionary.
If the field does not exist raise a KeyError.
Parameters: - field_name : str
Name of field to check.
-
extract_sweeps
(self, sweeps)[source]¶ Create a new radar contains only the data from select sweeps.
Parameters: - sweeps : array_like
Sweeps (0-based) to include in new Radar object.
Returns: - radar : Radar
Radar object which contains a copy of data from the selected sweeps.
-
get_azimuth
(self, sweep, copy=False)¶ Return an array of azimuth angles for a given sweep.
Parameters: - sweep : int
Sweep number to retrieve data for, 0 based.
- copy : bool, optional
True to return a copy of the azimuths. False, the default, returns a view of the azimuths (when possible), changing this data will change the data in the underlying Radar object.
Returns: - azimuths : array
Array containing the azimuth angles for a given sweep.
-
get_elevation
(self, sweep, copy=False)¶ Return an array of elevation angles for a given sweep.
Parameters: - sweep : int
Sweep number to retrieve data for, 0 based.
- copy : bool, optional
True to return a copy of the elevations. False, the default, returns a view of the elevations (when possible), changing this data will change the data in the underlying Radar object.
Returns: - azimuths : array
Array containing the elevation angles for a given sweep.
-
get_end
(self, sweep)¶ Return the ending ray for a given sweep.
-
get_field
(self, sweep, field_name, copy=False)¶ Return the field data for a given sweep.
When used with
get_gate_x_y_z()
this method can be used to obtain the data needed for plotting a radar field with the correct spatial context.Parameters: - sweep : int
Sweep number to retrieve data for, 0 based.
- field_name : str
Name of the field from which data should be retrieved.
- copy : bool, optional
True to return a copy of the data. False, the default, returns a view of the data (when possible), changing this data will change the data in the underlying Radar object.
Returns: - data : array
Array containing data for the requested sweep and field.
-
get_gate_lat_lon_alt
(self, sweep, reset_gate_coords=False, filter_transitions=False)¶ Return the longitude, latitude and altitude gate locations. Longitude and latitude are in degrees and altitude in meters.
With the default parameter this method returns the same data as contained in the gate_latitude, gate_longitude and gate_altitude attributes but this method performs the gate location calculations only for the specified sweep and therefore is more efficient than accessing this data through these attribute. If coordinates have at all, please use the reset_gate_coords parameter.
Parameters: - sweep : int
Sweep number to retrieve gate locations from, 0 based.
- reset_gate_coords : bool, optional
Optional to reset the gate latitude, gate longitude and gate altitude attributes before using them in this function. This is useful when the geographic coordinates have changed and gate latitude, gate longitude and gate altitude need to be reset.
- filter_transitions : bool, optional
True to remove rays where the antenna was in transition between sweeps. False will include these rays. No rays will be removed if the antenna_transition attribute is not available (set to None).
Returns: - lat, lon, alt : 2D array
Array containing the latitude, longitude and altitude, for all gates in the sweep.
-
get_gate_x_y_z
(self, sweep, edges=False, filter_transitions=False)¶ Return the x, y and z gate locations in meters for a given sweep.
With the default parameter this method returns the same data as contained in the gate_x, gate_y and gate_z attributes but this method performs the gate location calculations only for the specified sweep and therefore is more efficient than accessing this data through these attribute.
When used with
get_field()
this method can be used to obtain the data needed for plotting a radar field with the correct spatial context.Parameters: - sweep : int
Sweep number to retrieve gate locations from, 0 based.
- edges : bool, optional
True to return the locations of the gate edges calculated by interpolating between the range, azimuths and elevations. False (the default) will return the locations of the gate centers with no interpolation.
- filter_transitions : bool, optional
True to remove rays where the antenna was in transition between sweeps. False will include these rays. No rays will be removed if the antenna_transition attribute is not available (set to None).
Returns: - x, y, z : 2D array
Array containing the x, y and z, distances from the radar in meters for the center (or edges) for all gates in the sweep.
-
get_nyquist_vel
(self, sweep, check_uniform=True)¶ Return the Nyquist velocity in meters per second for a given sweep.
Raises a LookupError if the Nyquist velocity is not available, an Exception is raised if the velocities are not uniform in the sweep unless check_uniform is set to False.
Parameters: - sweep : int
Sweep number to retrieve data for, 0 based.
- check_uniform : bool
True to check to perform a check on the Nyquist velocities that they are uniform in the sweep, False will skip this check and return the velocity of the first ray in the sweep.
Returns: - nyquist_velocity : float
Array containing the Nyquist velocity in m/s for a given sweep.
-
get_slice
(self, sweep)¶ Return a slice for selecting rays for a given sweep.
-
get_start
(self, sweep)¶ Return the starting ray index for a given sweep.
-
get_start_end
(self, sweep)¶ Return the starting and ending ray for a given sweep.
-
info
(self, level='standard', out=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]¶ Print information on radar.
Parameters: - level : {‘compact’, ‘standard’, ‘full’, ‘c’, ‘s’, ‘f’}
Level of information on radar object to print, compact is minimal information, standard more and full everything.
- out : file-like
Stream to direct output to, default is to print information to standard out (the screen).
-
init_gate_altitude
(self)¶ Initialize the gate_altitude attribute.
-
init_gate_longitude_latitude
(self)¶ Initialize or reset the gate_longitude and gate_latitude attributes.
-
init_gate_x_y_z
(self)¶ Initialize or reset the gate_{x, y, z} attributes.
-
init_rays_per_sweep
(self)¶ Initialize or reset the rays_per_sweep attribute.
-
iter_azimuth
(self)¶ Return an iterator which returns sweep azimuth data.
-
iter_elevation
(self)¶ Return an iterator which returns sweep elevation data.
-
iter_end
(self)¶ Return an iterator over the sweep end indices.
-
iter_field
(self, field_name)¶ Return an iterator which returns sweep field data.
-
iter_slice
(self)¶ Return an iterator which returns sweep slice objects.
-
iter_start
(self)¶ Return an iterator over the sweep start indices.
-
iter_start_end
(self)¶ Return an iterator over the sweep start and end indices.
-
pyart.core.
antenna_to_cartesian
(ranges, azimuths, elevations)[source]¶ Return Cartesian coordinates from antenna coordinates.
Parameters: - ranges : array
Distances to the center of the radar gates (bins) in kilometers.
- azimuths : array
Azimuth angle of the radar in degrees.
- elevations : array
Elevation angle of the radar in degrees.
Returns: - x, y, z : array
Cartesian coordinates in meters from the radar.
Notes
The calculation for Cartesian coordinate is adapted from equations 2.28(b) and 2.28(c) of Doviak and Zrnic [1] assuming a standard atmosphere (4/3 Earth’s radius model).
\[ \begin{align}\begin{aligned}z = \sqrt{r^2+R^2+2*r*R*sin(\theta_e)} - R\\s = R * arcsin(\frac{r*cos(\theta_e)}{R+z})\\x = s * sin(\theta_a)\\y = s * cos(\theta_a)\end{aligned}\end{align} \]Where r is the distance from the radar to the center of the gate, \(\theta_a\) is the azimuth angle, \(\theta_e\) is the elevation angle, s is the arc length, and R is the effective radius of the earth, taken to be 4/3 the mean radius of earth (6371 km).
References
[1] Doviak and Zrnic, Doppler Radar and Weather Observations, Second Edition, 1993, p. 21.
-
pyart.core.
antenna_vectors_to_cartesian
(ranges, azimuths, elevations, edges=False)[source]¶ Calculate Cartesian coordinate for gates from antenna coordinate vectors.
Calculates the Cartesian coordinates for the gate centers or edges for all gates from antenna coordinate vectors assuming a standard atmosphere (4/3 Earth’s radius model). See
pyart.util.antenna_to_cartesian()
for details.Parameters: - ranges : array, 1D.
Distances to the center of the radar gates (bins) in meters.
- azimuths : array, 1D.
Azimuth angles of the rays in degrees.
- elevations : array, 1D.
Elevation angles of the rays in degrees.
- edges : bool, optional
True to calculate the coordinates of the gate edges by interpolating between gates and extrapolating at the boundaries. False to calculate the gate centers.
Returns: - x, y, z : array, 2D
Cartesian coordinates in meters from the center of the radar to the gate centers or edges.
-
pyart.core.
cartesian_to_antenna
(x, y, z)[source]¶ Returns antenna coordinates from Cartesian coordinates.
Parameters: - x, y, z : array
Cartesian coordinates in meters from the radar.
Returns: - ranges : array
Distances to the center of the radar gates (bins) in m.
- azimuths : array
Azimuth angle of the radar in degrees. [-180., 180]
- elevations : array
Elevation angle of the radar in degrees.
-
pyart.core.
cartesian_to_geographic
(x, y, projparams)[source]¶ Cartesian to Geographic coordinate transform.
Transform a set of Cartesian/Cartographic coordinates (x, y) to a geographic coordinate system (lat, lon) using pyproj or a build in Azimuthal equidistant projection.
Parameters: - x, y : array-like
Cartesian coordinates in meters unless R is defined in different units in the projparams parameter.
- projparams : dict or str
Projection parameters passed to pyproj.Proj. If this parameter is a dictionary with a ‘proj’ key equal to ‘pyart_aeqd’ then a azimuthal equidistant projection will be used that is native to Py-ART and does not require pyproj to be installed. In this case a non-default value of R can be specified by setting the ‘R’ key to the desired value.
Returns: - lon, lat : array
Longitude and latitude of the Cartesian coordinates in degrees.
-
pyart.core.
cartesian_to_geographic_aeqd
(x, y, lon_0, lat_0, R=6370997.0)[source]¶ Azimuthal equidistant Cartesian to geographic coordinate transform.
Transform a set of Cartesian/Cartographic coordinates (x, y) to geographic coordinate system (lat, lon) using a azimuthal equidistant map projection [1].
\[ \begin{align}\begin{aligned}lat = \arcsin(\cos(c) * \sin(lat_0) + (y * \sin(c) * \cos(lat_0) / \rho))\\lon = lon_0 + \arctan2( x * \sin(c), \rho * \cos(lat_0) * \cos(c) - y * \sin(lat_0) * \sin(c))\\\rho = \sqrt(x^2 + y^2)\\c = \rho / R\end{aligned}\end{align} \]Where x, y are the Cartesian position from the center of projection; lat, lon the corresponding latitude and longitude; lat_0, lon_0 are the latitude and longitude of the center of the projection; R is the radius of the earth (defaults to ~6371 km). lon is adjusted to be between -180 and 180.
Parameters: - x, y : array-like
Cartesian coordinates in the same units as R, typically meters.
- lon_0, lat_0 : float
Longitude and latitude, in degrees, of the center of the projection.
- R : float, optional
Earth radius in the same units as x and y. The default value is in units of meters.
Returns: - lon, lat : array
Longitude and latitude of Cartesian coordinates in degrees.
References
[1] Snyder, J. P. Map Projections–A Working Manual. U. S. Geological Survey Professional Paper 1395, 1987, pp. 191-202.
-
pyart.core.
cartesian_vectors_to_geographic
(x, y, projparams, edges=False)[source]¶ Cartesian vectors to Geographic coordinate transform.
Transform a set of Cartesian/Cartographic coordinate vectors (x, y) to a geographic coordinate system (lat, lon) using pyproj or a build in Azimuthal equidistant projection finding the coordinates edges in Cartesian space if requested.
Parameters: - x, y : array 1D.
Cartesian coordinate vectors in meters unless R is defined in different units in the projparams parameter.
- projparams : dict or str
Projection parameters passed to pyproj.Proj. If this parameter is a dictionary with a ‘proj’ key equal to ‘pyart_aeqd’ then a azimuthal equidistant projection will be used that is native to Py-ART and does not require pyproj to be installed. In this case a non-default value of R can be specified by setting the ‘R’ key to the desired value.
- edges : bool, optional
True to calculate the coordinates of the geographic edges by interpolating between Cartesian points and extrapolating at the boundaries. False to calculate the coordinate centers.
Returns: - lon, lat : array
Longitude and latitude of the Cartesian coordinates in degrees.
-
pyart.core.
geographic_to_cartesian
(lon, lat, projparams)[source]¶ Geographic to Cartesian coordinate transform.
Transform a set of Geographic coordinate (lat, lon) to a Cartesian/Cartographic coordinate (x, y) using pyproj or a build in Azimuthal equidistant projection.
Parameters: - lon, lat : array-like
Geographic coordinates in degrees.
- projparams : dict or str
Projection parameters passed to pyproj.Proj. If this parameter is a dictionary with a ‘proj’ key equal to ‘pyart_aeqd’ then a azimuthal equidistant projection will be used that is native to Py-ART and does not require pyproj to be installed. In this case a non-default value of R can be specified by setting the ‘R’ key to the desired value.
Returns: - x, y : array-like
Cartesian coordinates in meters unless projparams defines a value for R in different units.
-
pyart.core.
geographic_to_cartesian_aeqd
(lon, lat, lon_0, lat_0, R=6370997.0)[source]¶ Azimuthal equidistant geographic to Cartesian coordinate transform.
Transform a set of geographic coordinates (lat, lon) to Cartesian/Cartographic coordinates (x, y) using a azimuthal equidistant map projection [1].
\[ \begin{align}\begin{aligned}x = R * k * \cos(lat) * \sin(lon - lon_0)\\y = R * k * [\cos(lat_0) * \sin(lat) - \sin(lat_0) * \cos(lat) * \cos(lon - lon_0)]\\k = c / \sin(c)\\c = \arccos(\sin(lat_0) * \sin(lat) + \cos(lat_0) * \cos(lat) * \cos(lon - lon_0))\end{aligned}\end{align} \]Where x, y are the Cartesian position from the center of projection; lat, lon the corresponding latitude and longitude; lat_0, lon_0 are the latitude and longitude of the center of the projection; R is the radius of the earth (defaults to ~6371 km).
Parameters: - lon, lat : array-like
Longitude and latitude coordinates in degrees.
- lon_0, lat_0 : float
Longitude and latitude, in degrees, of the center of the projection.
- R : float, optional
Earth radius in the same units as x and y. The default value is in units of meters.
Returns: - x, y : array
Cartesian coordinates in the same units as R, typically meters.
References
[1] Snyder, J. P. Map Projections–A Working Manual. U. S. Geological Survey Professional Paper 1395, 1987, pp. 191-202.
-
pyart.core.
wgs84_to_swissCH1903
(lon, lat, alt, no_altitude_transform=False)[source]¶ Convert WGS84 coordinates to swiss coordinates (CH1903 / LV03)
The formulas for the coordinates transformation are taken from: “Formeln und Konstanten für die Berechnung der Schweizerischen schiefachsigen Zylinderprojektion und der Transformation zwischen Koordinatensystemen”, chapter 4. “Näherungslösungen CH1903 <=> WGS84” Bundesamt für Landestopografie swisstopo (http://www.swisstopo.admin.ch), Oktober 2008
Parameters: - lon, lat : array-like
Geographic coordinates WGS84 in degrees.
- alt : array-like
Altitude in m
- no_altitude_transform : bool
If set, do not convert altitude
Returns: - chy, chx, chh : array-like
Coordinates in swiss CH1903 coordinates in meter