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