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

Fake TCC variable #30

Merged
merged 6 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions india_forecast_app/models/pvnet/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ def _prepare_data_sources(self):
# Process/cache remote zarr locally
process_and_cache_nwp(nwp_source_file_path, nwp_path)

# set NWP_ZARR_PATH as this new path
os.environ["NWP_ZARR_PATH"] = nwp_path
peterdudfield marked this conversation as resolved.
Show resolved Hide resolved

if self.asset_type == "wind":
# Clear local cached wind data if already exists
shutil.rmtree(wind_path, ignore_errors=True)
Expand Down
7 changes: 7 additions & 0 deletions india_forecast_app/models/pvnet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ def process_and_cache_nwp(source_nwp_path: str, dest_nwp_path: str):
new_variables.append(var)
ds.__setitem__('variable', new_variables)

log.warning('Faking TCC variable in NWP data')
# TODO remove this when tcc variable is available
# adding tcc, which is the sum of hcc, lcc and mcc
tcc = ds.sel(variable=['hcc','mcc','lcc']).mean(dim=['variable'])
tcc = tcc.expand_dims('variable').assign_coords(variable=['tcc'])
ds = ds.merge(tcc)

# Save destination path
ds.to_zarr(dest_nwp_path, mode="a")

Expand Down
Loading