Skip to content

Commit

Permalink
Regrid (#154)
Browse files Browse the repository at this point in the history
* add regridding

* lint

* lint

* update to run more effeciently in app

* fix

* remove hard coding

* lint

* lint

* lint

* fix bug

* fix

* use relative path

* use __file__

* use correct __file__

* fix
  • Loading branch information
peterdudfield authored Dec 2, 2024
1 parent b2a7af8 commit fb2e734
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions india_forecast_app/models/pvnet/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from ocf_datapipes.utils.consts import ELEVATION_MEAN, ELEVATION_STD
from pydantic import BaseModel

from india_forecast_app.data.nwp import regrid_nwp_data
from india_forecast_app.data import nwp

from .consts import (
nwp_ecmwf_path,
Expand Down Expand Up @@ -160,8 +160,11 @@ def process_and_cache_nwp(nwp_config: NWPProcessAndCacheConfig):
nwp_channels = list(nwp_config.config.nwp_channels)
ds = ds.sel(variable=nwp_channels)

# get directory of file
regrid_coords = os.path.dirname(nwp.__file__)

# regrid data
ds = regrid_nwp_data(ds, "india_forecast_app/data/mo_global/india_coords.nc")
ds = nwp.regrid_nwp_data(ds, f"{regrid_coords}/mo_global/india_coords.nc")

# Save destination path
log.info(f"Saving NWP data to {dest_nwp_path}")
Expand Down

0 comments on commit fb2e734

Please sign in to comment.