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

add new pv runvl model #158

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions india_forecast_app/models/all_models.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ models:
version: d71104620f0b0bdd3eeb63cafecd2a49032ae0f7
client: ruvnl
asset_type: pv
- name: pvnet_india_ecmwf_mo_gfs
type: pvnet
id: openclimatefix/pvnet_india
version: 0561e737765df164b572fa506401995263c6401b
client: ruvnl
asset_type: pv
# Ad client solar
- name: pvnet_ad_sites
type: pvnet
Expand Down
22 changes: 15 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def generation_db_values(db_session, sites, init_timestamp):
def generation_db_values_only_wind(db_session, sites, init_timestamp):
"""Create some fake generations"""

n = 20*25 # 25 hours of readings
n = 20 * 25 # 25 hours of readings
start_times = [init_timestamp - dt.timedelta(minutes=x * 3) for x in range(n)]

# remove some of the most recent readings (to simulate missing timestamps)
Expand Down Expand Up @@ -361,12 +361,9 @@ def nwp_mo_global_data(tmp_path_factory, time_before_present):

# Load dataset which only contains coordinates, but no data
ds = xr.open_zarr(
f"{os.path.dirname(os.path.abspath(__file__))}/test_data/nwp-no-data_gfs.zarr"
f"{os.path.dirname(os.path.abspath(__file__))}/test_data/nwp-no-data.zarr"
)

# rename dimension init_time_utc to init_time
ds = ds.rename({"init_time_utc": "init_time"})

# Last t0 to at least 4 hours ago and floor to 3-hour interval
t0_datetime_utc = time_before_present(dt.timedelta(hours=0)).floor("3h")
t0_datetime_utc = t0_datetime_utc - dt.timedelta(hours=4)
Expand All @@ -389,10 +386,21 @@ def nwp_mo_global_data(tmp_path_factory, time_before_present):
ds[v].encoding.clear()

# change variables values to for MO global
ds.variable.values[0:3] = ["temperature_sl", "wind_u_component_10m", "wind_v_component_10m"]
ds.variable.values[0:10] = [
"temperature_sl",
"wind_u_component_10m",
"wind_v_component_10m",
"downward_shortwave_radiation_flux_gl",
"cloud_cover_high",
"cloud_cover_low",
"cloud_cover_medium",
"relative_humidity_sl",
"snow_depth_gl",
"visibility_sl",
]

# interpolate 3 hourly step to 1 hour steps
steps = pd.TimedeltaIndex(np.arange(49) * 3600 * 1e9, freq='infer')
steps = pd.TimedeltaIndex(np.arange(49) * 3600 * 1e9, freq="infer")
ds = ds.interp(step=steps, method="linear")

ds["mo_global"] = xr.DataArray(
Expand Down
2 changes: 1 addition & 1 deletion tests/models/test_pydantic_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
def test_get_all_models():
"""Test for getting all models"""
models = get_all_models()
assert len(models.models) == 9
assert len(models.models) == 10


def test_get_all_models_client():
Expand Down
Loading