1.5.1.1.6.1.2. polar2grid.grids.manager module

Utilities and accessor functions to grids and projections used in polar2grid.

class polar2grid.grids.manager.GridManager(*grid_configs)[source]

Bases: object

Object that holds grid information about the grids added to it.

add_grid_config(grid_config_filename)[source]

Load a grid configuration file.

If a grid_name was already added its information is overwritten.

add_grid_config_str(grid_config_line)[source]
add_proj4_grid_info(grid_name, proj4_str, width, height, cell_width, cell_height, origin_x, origin_y)[source]
get_grid_definition(grid_name: str) GridDefinition[source]

Return a standard GridDefinition object for the specified grid.

Returns:

GridDefinition object, updates to this object do not affect information internal to the Cartographer.

get_grid_info(grid_name)[source]

Return a grid information dictionary about the grid_name specified.

The information returned will always be a copy of the information stored internally in this object. So a change to the dictionary returned does NOT affect the internal information.

Raises:

ValueError – if grid_name does not exist

grid_information: dict[str, dict] = {}
polar2grid.grids.manager._convert_numeric_parameters_to_floats(proj4_dict)[source]
polar2grid.grids.manager._convert_origin_degrees_to_meters_if_needed(grid_name, info)[source]
polar2grid.grids.manager._generate_valid_parts_in_config_str(config_str: str)[source]
polar2grid.grids.manager._only_one_specified(a, b)[source]
polar2grid.grids.manager._parse_grid_width_and_height(grid_name, width_part, height_part)[source]
polar2grid.grids.manager._parse_meter_degree_param(param) tuple[float, bool][source]

Parse a configuration parameter that could be meters or degrees.

Degrees are denoted with a suffix of ‘deg’. Meters are denoted with a suffix of either ‘m’ or no suffix at all.

Returns:

(float param, True if degrees/False if meters)

polar2grid.grids.manager._parse_optional_config_param(str_part, convert_func, unspecified_info=None)[source]
polar2grid.grids.manager._parse_origin_x_y(grid_name, x_part, y_part, crs)[source]
polar2grid.grids.manager._parse_pixel_size_x_y(grid_name, x_part, y_part)[source]
polar2grid.grids.manager._parse_proj4_str(proj4_str, grid_name)[source]
polar2grid.grids.manager.get_proj4_info(proj4_str)[source]
polar2grid.grids.manager.parse_and_convert_proj4_config_line(grid_name, parts)[source]

Return a dictionary of information for a specific PROJ.4 grid from a grid configuration line.

parts should be every comma-separated part of the line including the grid_name.

polar2grid.grids.manager.parse_proj4_config_line(grid_name, parts)[source]
polar2grid.grids.manager.read_grids_config(config_filepath, convert_coords=True)[source]

Read the “grids.conf” file and create dictionaries mapping the grid name to the necessary information.

There are two dictionaries created, one for gpd file grids and one for proj4 grids.

Format for proj4 grids: grid_name,proj4,proj4_str,pixel_size_x,pixel_size_y,origin_x,origin_y,width,height

where ‘proj4’ is the actual text ‘proj4’ to define the grid as a proj4 grid.

polar2grid.grids.manager.read_grids_config_str(config_str, convert_coords=True)[source]