Fetches pixels from an image asset. Args: params: An object containing parameters with the following possible values: assetId - The asset ID for which to get pixels. Must be an image asset. fileFormat - The resulting file format. Defaults to png. See https://developers.g
(params: dict[str, Any])
| 831 | |
| 832 | |
| 833 | def getPixels(params: dict[str, Any]) -> Any: |
| 834 | """Fetches pixels from an image asset. |
| 835 | |
| 836 | Args: |
| 837 | params: An object containing parameters with the following possible values: |
| 838 | assetId - The asset ID for which to get pixels. Must be an image asset. |
| 839 | fileFormat - The resulting file format. Defaults to png. See |
| 840 | https://developers.google.com/earth-engine/reference/rest/v1/ImageFileFormat |
| 841 | for the available formats. There are additional formats that convert |
| 842 | the downloaded object to a Python data object. These include: |
| 843 | NUMPY_NDARRAY, which converts to a structured NumPy array. |
| 844 | grid - Parameters describing the pixel grid in which to fetch data. |
| 845 | Defaults to the native pixel grid of the data. |
| 846 | region - If present, the region of data to return, specified as a GeoJSON |
| 847 | geometry object (see RFC 7946). |
| 848 | bandIds - If present, specifies a specific set of bands from which to get |
| 849 | pixels. |
| 850 | visualizationOptions - If present, a set of visualization options to apply |
| 851 | before the pixels are returned. See |
| 852 | https://developers.google.com/earth-engine/reference/rest/v1/VisualizationOptions |
| 853 | for details. |
| 854 | |
| 855 | Returns: |
| 856 | The pixels as raw image data. |
| 857 | """ |
| 858 | params = params.copy() |
| 859 | name = _cloud_api_utils.convert_asset_id_to_asset_name(params.get('assetId')) |
| 860 | del params['assetId'] |
| 861 | converter = _extract_image_converter(params) |
| 862 | params['fileFormat'] = _cloud_api_utils.convert_to_image_file_format( |
| 863 | converter.expected_data_format() |
| 864 | ) |
| 865 | _maybe_populate_workload_tag(params) |
| 866 | data = _execute_cloud_call( |
| 867 | _get_cloud_projects_raw() |
| 868 | .assets() |
| 869 | .getPixels(name=name, body=params) |
| 870 | ) |
| 871 | if converter: |
| 872 | return converter.do_conversion(data) |
| 873 | return data |
| 874 | |
| 875 | |
| 876 | def computePixels(params: dict[str, Any]) -> Any: |
nothing calls this directly
no test coverage detected