Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove nans in nwp #163

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions pvnet_app/data/nwp.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,16 @@ def rename_ecmwf_variables():
# if the variable HRES-IFS_uk is there
if "HRES-IFS_uk" in d.data_vars:
logger.info(f"Renaming the ECMWF variables")

d = d.rename({"HRES-IFS_uk": "ECMWF_UK"})

# remove anything >60 in latitude
logger.info(f"Removing data above 60 latitude")
d = d.where(d.latitude <= 60, drop=True)

# remove anything step > 83
logger.info(f"Removing data after step 83, step 84 is nan")
d = d.where(d.step <= d.step[83], drop=True)

# rename variable names in the variable coordinate
# This is a renaming from ECMWF variables to what we use in the ML Model
# This change happened in the new nwp-consumer>=1.0.0
Expand All @@ -197,7 +204,7 @@ def rename_ecmwf_variables():
'temperature_sl': 't',
'total_precipitation_rate_gl': 'prate',
'visibility_sl': 'vis',
'wind_u_component_100m': '100',
'wind_u_component_100m': 'u100',
'wind_u_component_10m': 'u10',
'wind_u_component_200m': 'u200',
'wind_v_component_100m': 'v100',
Expand All @@ -209,6 +216,7 @@ def rename_ecmwf_variables():

# assign the new variable names
d = d.assign_coords(variable=variable_coords)
d = d.compute()

# save back to path
os.system(f"rm -rf {nwp_ecmwf_path}")
Expand Down
Loading