vyperdatum.drivers.vrbag
Attributes
Functions
|
Return True if fname points to a variable resolution BAG file. |
|
Take indices of a cell from the base grid and return x, y. |
|
Transform the low-resolution grid and return the transformed values. |
|
Update the elevation layer in the vrbag file with the arr values. |
|
Return the starting index and coordinates of the points of subgrid i, j. |
|
Apply point transformation of subgrid points. |
|
Identify the subgrids within the vrbag and return the starting |
|
Extract a subgrid from from the vrbag file, convert to GeoTiff, and apply transformation. |
|
Identify the subgrids within the vrbag and return the starting |
|
Return the corner points indicated in the xml metadata. |
|
Update the xml metadata's corner points, horizontal, and vertical WKTs with new values. |
|
Update the varres_refinements layer in the vrbag file with the |
|
Transform vrbag according to the tf Transformer object. |
|
Return wkt retrieved by GDAL. |
Module Contents
- vyperdatum.drivers.vrbag.logger
- vyperdatum.drivers.vrbag.is_vr(fname: str) bool
Return True if fname points to a variable resolution BAG file.
- vyperdatum.drivers.vrbag.index_to_xy(i: int, j: int, geot: tuple, x_offset, y_offset)
Take indices of a cell from the base grid and return x, y.
- vyperdatum.drivers.vrbag.base_grid_point_transform(fname: str, tf, nodata_value) numpy.ndarray
Transform the low-resolution grid and return the transformed values.
- Parameters:
fname (str) – Absolute path to the vrbag file.
tf (vyperdatum.transformer.Transformer) – Instance of the transformer class.
nodata_value (float) – No_Data_Value used in the vrbag elevation layer.
- Returns:
The transformed vrbag elevation layer.
- Return type:
np.ndarray
- vyperdatum.drivers.vrbag.update_vr_elevation(fname: str, arr: numpy.ndarray) None
Update the elevation layer in the vrbag file with the arr values.
- Parameters:
fname (str) – Absolute path to the vrbag file.
arr (np.ndarray) – numpy array representing the elevation values to be updated.
- Return type:
None
- vyperdatum.drivers.vrbag.get_subgrid_points(fname: str, i: int, j: int) tuple[list[int], list[float], list[float], list[float]]
Return the starting index and coordinates of the points of subgrid i, j.
- vyperdatum.drivers.vrbag.single_subgrid_point_transform(fname: str, i: int, j: int, tf, nodata_value) tuple[int | None, numpy.ndarray | None]
Apply point transformation of subgrid points.
- Parameters:
fname (str) – Absolute path to the vrbag file.
i (int) – The first index of the subgrid.
j (int) – The second index of the subgrid.
tf (vyperdatum.transformer.Transformer) – Instance of the transformer class.
nodata_value (float) – No_Data_Value used for the generated GeoTiff.
- Returns:
The starting index of the subgrid in the varres_refinements layer. The transformed subgrid depth values in form of a 1-d array.
- Return type:
- vyperdatum.drivers.vrbag.subgrid_point_transform(fname: str, tf) tuple[list[int], list[float]]
Identify the subgrids within the vrbag and return the starting index and the depth values within each subgrid.
- vyperdatum.drivers.vrbag.single_subgrid_rsater_transform(fname: str, rasters_dir: str, i: int, j: int, tf, nodata_value) tuple[int | None, numpy.ndarray | None]
Extract a subgrid from from the vrbag file, convert to GeoTiff, and apply transformation.
- Parameters:
fname (str) – Absolute path to the vrbag file.
rasters_dir (str) – Absolute path to the directory where the output TIFF files will be stored.
i (int) – First index of the subgrid.
j (int) – Second index of the subgrid.
tf (vyperdatum.transformer.Transformer) – Instance of the transformer class.
nodata_value (float) – No_Data_Value used for the generated GeoTiff.
- Returns:
The starting index of the subgrid in the varres_refinements layer.
The transformed subgrid in form of a 1-d array.
- vyperdatum.drivers.vrbag.subgrid_raster_transform(fname: str, rasters_dir: str, tf) tuple[list[int], list[float]]
Identify the subgrids within the vrbag and return the starting index and the depth values within each subgrid.
- Parameters:
fname (str) – Absolute path to the vrbag file.
rasters_dir (str) – Absolute path to the directory where the output TIFF files will be stored.
tf (vyperdatum.transformer.Transformer) – Instance of the transformer class.
- Returns:
Starting index of each subgrid. Transformed subgrid depth values.
- Return type:
- vyperdatum.drivers.vrbag.corner_points(fname: str) tuple[float, float, float, float]
Return the corner points indicated in the xml metadata.
- vyperdatum.drivers.vrbag.change_corner_points_and_wkt(fname: str, new_points: str, wkt_h: str, wkt_v: str) None
Update the xml metadata’s corner points, horizontal, and vertical WKTs with new values.
- Parameters:
fname (str) – Absolute path to the vrbag file.
new_points (str) – The new corners points in string format x1,y1 x2,y2. Will be ignored when None.
wkt_h (str) – WKT string for the horizontal component of the CRS. Will be ignored when None.
wkt_v (str) – WKT string for the vertical component of the CRS. Will be ignored when None.
- Return type:
None
- vyperdatum.drivers.vrbag.update_vr_refinements(fname: str, index: list[int], arr: list[numpy.ndarray], tf) None
Update the varres_refinements layer in the vrbag file with the arr values starting form index location in the varres_refinements.
- Parameters:
fname (str) – Absolute path to the vrbag file.
index (list[int]) – A list of starting index where the refinements get updated.
arr (list[np.ndarray]) – List of numpy array representing the refinements values to be updated.
tf (vyperdatum.transformer.Transformer) – Instance of the transformer class.
- Return type:
None
- vyperdatum.drivers.vrbag.transform(fname: str, tf, vdatum_check: bool = True, point_transformation: bool = True, **kwargs) bool
Transform vrbag according to the tf Transformer object. When point_transformation is True, point transformation is applied, otherwise vrbag is split into rasters and raster transformation is applied. When raster transformation is chosen, a new keyword argument rasters_dir must be passed that specifies where the subgrid rasters are stored.
- Parameters:
fname (str) – Absolute path to the vrbag file.
index (list[int]) – A list of starting index where the refinements get updated.
arr (list[np.ndarray]) – List of numpy array representing the refinements values to be updated.
tf (vyperdatum.transformer.Transformer) – Instance of the transformer class.
vdatum_check (bool, default=True) – If True, a random sample of the transformed data are compared with transformation outcomes produced by Vdatum REST API.
rasters_dir (str) – Absolute path to the directory where the output TIFF files will be stored. When raster transformation is chosen, this parameter must be passed which specifies where the subgrid rasters are stored. It can point to a local dir (e.g. rasters_dir = “./sub_grids/”) or GDAL virtual file system (e.g. rasters_dir = “/vsimem/sub_grids/”).
- Raises:
- Returns:
True if successful, otherwise False.
- Return type: