Skip to content

Commit

Permalink
added deprecation warning to prudence regions
Browse files Browse the repository at this point in the history
  • Loading branch information
larsbuntemeyer committed Jul 4, 2023
1 parent ff77e83 commit 1a359fe
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions cordex/regions/_prudence.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
from warnings import warn

import pandas as pd
import xarray as xr

from ._regions import WGS84
from ._resources import fetch_prudence

message = (
"Prudence regions are deprecated and will be removed in a future version."
"Please use regionmask.defined_regions.prudence instead."
)


def _create_polygons(df):
from shapely.geometry import Polygon
Expand Down Expand Up @@ -63,17 +70,37 @@ class Prudence:

@property
def df(self):
warn(
message,
DeprecationWarning,
stacklevel=2,
)
return pd.read_csv(fetch_prudence(), na_filter=False, index_col="area")

@property
def geodataframe(self):
warn(
message,
DeprecationWarning,
stacklevel=2,
)
return geodataframe(self.df)

@property
def regionmask(self):
warn(
message,
DeprecationWarning,
stacklevel=2,
)
return regions(self.df)

def mask_3D(self, lon, lat, **kwargs):
warn(
message,
DeprecationWarning,
stacklevel=2,
)
return mask_3D(self.regionmask, lon, lat, **kwargs)


Expand Down

0 comments on commit 1a359fe

Please sign in to comment.