From fb2e7340eac2dd489527d9e26109ad0b571ff89e Mon Sep 17 00:00:00 2001 From: Peter Dudfield <34686298+peterdudfield@users.noreply.github.com> Date: Mon, 2 Dec 2024 16:02:27 +0000 Subject: [PATCH] Regrid (#154) * 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 --- india_forecast_app/models/pvnet/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/india_forecast_app/models/pvnet/utils.py b/india_forecast_app/models/pvnet/utils.py index 59e4fb8..9dfbb89 100644 --- a/india_forecast_app/models/pvnet/utils.py +++ b/india_forecast_app/models/pvnet/utils.py @@ -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, @@ -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}")