Skip to content

Commit

Permalink
added try-catch around CRS deserialization handling (#379)
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksMat committed Feb 9, 2022
1 parent 10f2fea commit d329ee7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/eolearn/core/eodata_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,13 @@ def _decode(self, file, path):
dataframe = gpd.read_file(file)

if dataframe.crs is not None:
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=SHUserWarning)
dataframe.crs = CRS(dataframe.crs).pyproj_crs()
# Trying to preserve a standard CRS and passing otherwise
try:
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=SHUserWarning)
dataframe.crs = CRS(dataframe.crs).pyproj_crs()
except ValueError:
pass

if "TIMESTAMP" in dataframe:
dataframe.TIMESTAMP = pd.to_datetime(dataframe.TIMESTAMP)
Expand Down

0 comments on commit d329ee7

Please sign in to comment.