Skip to content

Commit

Permalink
add warning
Browse files Browse the repository at this point in the history
  • Loading branch information
juliettelavoie committed Nov 16, 2023
1 parent d841b55 commit aed52db
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions xscen/extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,12 @@ def _dispatch_historical_to_future(catalog: DataCatalog, id_columns: list):
hist = sdf[sdf.experiment == "historical"]
if hist.empty:
continue
if np.NaN in set(sdf.activity):
warnings.warn(
f"np.NaN was found in the activity column of {group}. The rows with np.NaN activity will be skipped."
"If you want them to be included in the matching historical and future matching, please put a valid activity (https://xscen.readthedocs.io/en/latest/columns.html)."
"For example, xscen expects experiment `historical` to have `CMIP` activity and experiments `sspXYZ` to have `ScenarioMIP` activity. "
)
for activity_id in set(sdf.activity) - {"HighResMip", np.NaN}:
sub_sdf = sdf[sdf.activity == activity_id]
for exp_id in set(sub_sdf.experiment) - {"historical", "piControl", np.NaN}:
Expand Down

0 comments on commit aed52db

Please sign in to comment.