From 8ee5b47cf9aaa6750dea51a50dcb9a7e48f990aa Mon Sep 17 00:00:00 2001 From: Kristof Van Tricht Date: Tue, 3 Sep 2024 12:52:36 +0200 Subject: [PATCH] :facepalm: --- presto/dataset.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/presto/dataset.py b/presto/dataset.py index 2a387ca..dee6de7 100644 --- a/presto/dataset.py +++ b/presto/dataset.py @@ -426,7 +426,7 @@ def _extract_eo_data(cls, inarr: xr.DataArray) -> Tuple[np.ndarray, np.ndarray]: return eo_data, mask @staticmethod - def _extract_latlons(inarr: xr.DataArray, epsg: int) -> np.ndarray: # type: ignore + def _extract_latlons(inarr: xr.DataArray, epsg: int) -> np.ndarray: """ Extracts latitudes and longitudes from the input xarray.DataArray. @@ -496,6 +496,9 @@ def nc_to_arrays( ) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]: ds = xr.open_dataset(filepath) epsg = CRS.from_wkt(xr.open_dataset(filepath).crs.attrs["crs_wkt"]).to_epsg() + + if epsg is None: + raise ValueError("EPSG code not found in the input file.") inarr = ds.drop("crs").to_array(dim="bands") eo_data, mask = cls._extract_eo_data(inarr)