cars.core.inputs
Inputs module: contains some CARS global shared general purpose inputs functions
Functions
|
Read vector file and returns the corresponding polygon |
|
Get the z position of corresponding x and y as lon lat |
|
Get the number of bands in an image file |
|
Get the number of bands in an image file |
|
Get the tags in an image file |
|
Get the image type |
|
Get the band nbits list |
|
Get the size of an image (file) |
|
Get the no data value |
|
Get the dtype of an image (file) |
|
Get pixel point coordinates of terrain points |
|
Get the resolution of raster_file |
|
Get the bounds of an image (file) |
|
Get the epsg code of an image (file) |
|
Get the stats of an image (file) |
|
Get the data of an image file, and its profile |
|
Get the profile of an image file |
|
Get the transform of an image file |
|
Get the epsg of an image file |
|
Get the crs of an image file |
|
Modify epsg of raster file |
|
Test if a file can be open by rasterio |
|
Checks if the given file can be opened by NetCDF |
|
Check a dictionary with respect to a schema |
|
Get the descriptions bands of an image file |
Module Contents
- cars.core.inputs.read_vector(path_to_file)[source]
Read vector file and returns the corresponding polygon
:raise Exception when the input file is unreadable
- Parameters:
path_to_file (str) – path to the file to open
- Returns:
a shapely polygon
- Return type:
tuple (polygon, epsg)
- cars.core.inputs.rasterio_get_values(raster_file: str, x_list, y_list, proj_function)[source]
Get the z position of corresponding x and y as lon lat
- Parameters:
raster_file – Image file
x_list (np array) – list of x position
y_list (np array) – list of y position
proj_function – projection function to use
- Returns:
The corresponding z position
- cars.core.inputs.rasterio_get_nb_bands(raster_file: str) int[source]
Get the number of bands in an image file
- Parameters:
raster_file – Image file
- Returns:
The number of bands
- cars.core.inputs.rasterio_get_classif_values(raster_file: str) int[source]
Get the number of bands in an image file
- Parameters:
raster_file – Image file
- Returns:
The number of bands
- cars.core.inputs.rasterio_get_tags(raster_file: str) dict[source]
Get the tags in an image file
- Parameters:
raster_file – Image file
- Returns:
The metadata
- cars.core.inputs.rasterio_get_image_type(raster_file: str) list[source]
Get the image type
- Parameters:
raster_file – Image file
- Returns:
The image type
- cars.core.inputs.rasterio_get_nbits(raster_file)[source]
Get the band nbits list
- Parameters:
raster_file – Image file
- Returns:
The band nbits list
- cars.core.inputs.rasterio_get_size(raster_file: str) Tuple[int, int][source]
Get the size of an image (file)
- Parameters:
raster_file – Image file
- Returns:
The size (width, height)
- cars.core.inputs.rasterio_get_nodata(raster_file: str) Tuple[int, int][source]
Get the no data value
- Parameters:
raster_file – Image file
- Returns:
the no data value
- cars.core.inputs.rasterio_get_dtype(raster_file: str) Tuple[int, int][source]
Get the dtype of an image (file)
- Parameters:
raster_file – Image file
- Returns:
The dtype
- cars.core.inputs.rasterio_get_pixel_points(raster_file: str, terrain_points) list[source]
Get pixel point coordinates of terrain points
- Parameters:
raster_file – Image file
terrain_points – points in terrain
- Returns:
pixel points
- cars.core.inputs.rasterio_get_resolution(raster_file: str) Tuple[float, float][source]
Get the resolution of raster_file
- Parameters:
raster_file – Image file
- Returns:
The resolution (res_x, res_y)
- Return type:
tuple
- cars.core.inputs.rasterio_get_bounds(raster_file: str, apply_resolution_sign=False) Tuple[int, int][source]
Get the bounds of an image (file)
- Parameters:
raster_file – Image file
- Returns:
The size (width, height)
- cars.core.inputs.rasterio_get_epsg_code(raster_file: str) Tuple[int, int][source]
Get the epsg code of an image (file)
- Parameters:
raster_file – Image file
- Returns:
epsg code
- cars.core.inputs.rasterio_get_list_min_max(raster_file: str) Tuple[int, int][source]
Get the stats of an image (file)
- Parameters:
raster_file – Image file
- Returns:
The list min max
- cars.core.inputs.rasterio_read_as_array(raster_file: str, window: rasterio.windows.Window = None) Tuple[numpy.ndarray, dict][source]
Get the data of an image file, and its profile
- Parameters:
raster_file – Image file
window – Window to get data from
- Returns:
The array, its profile
- cars.core.inputs.rasterio_get_profile(raster_file: str) Dict[source]
Get the profile of an image file
- Parameters:
raster_file – Image file
- Returns:
The profile of the given image
- cars.core.inputs.rasterio_get_transform(raster_file: str, convention: str = None) Dict[source]
Get the transform of an image file
- Parameters:
raster_file – Image file
convention – The convention to follow: None, “north” or “south”
- Returns:
The transform of the given image
- cars.core.inputs.rasterio_get_epsg(raster_file: str) int[source]
Get the epsg of an image file
- Parameters:
raster_file – Image file
- Returns:
The epsg of the given image
- cars.core.inputs.rasterio_get_crs(raster_file: str) pyproj.CRS[source]
Get the crs of an image file
- Parameters:
raster_file – Image file
- Returns:
The crs of the given image
- cars.core.inputs.rasterio_transform_epsg(file_name, new_epsg)[source]
Modify epsg of raster file
- Parameters:
file_name – Image file
new_epsg – new epsg
- cars.core.inputs.rasterio_can_open(raster_file: str) bool[source]
Test if a file can be open by rasterio
- Parameters:
raster_file – File to test
- Returns:
True if rasterio can open file and False otherwise
- cars.core.inputs.ncdf_can_open(file_path)[source]
Checks if the given file can be opened by NetCDF :param file_path: file path. :type file_path: str :return: True if it can be opened, False otherwise. :rtype: bool