Skip to content

Commit

Permalink
local case regions
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Sep 2, 2024
1 parent d843c99 commit f5fecfe
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 32 deletions.
37 changes: 18 additions & 19 deletions src/nwp_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@
region = os.getenv("REGION", "UK")
environment = os.getenv("ENVIRONMENT", "development")

all_nwps = {
"uk": {
"UKV": f"s3://nowcasting-nwp-{environment}/data-national/latest.zarr",
"ECMWF": f"s3://nowcasting-nwp-{environment}/ecmwf/data/latest.zarr",
},
"india": {
"ECMWF": f"s3://india-nwp-{environment}/ecmwf/data/latest.zarr",
"GFS": f"s3://nowcasting-nwp-{environment}/gfs/data/latest.zarr",
},
}

nwp_key_list = list(all_nwps[region].keys()) + ["Other"]


def get_data(zarr_file):

Expand Down Expand Up @@ -52,20 +65,6 @@ def get_data(zarr_file):
return ds


all_nwps = {
"UK": {
"UKV": f"s3://nowcasting-nwp-{environment}/data-national/latest.zarr",
"ECMWF": f"s3://nowcasting-nwp-{environment}/ecmwf/data/latest.zarr",
},
"India": {
"ECMWF": f"s3://india-nwp-{environment}/ecmwf/data/latest.zarr",
"GFS": f"s3://nowcasting-nwp-{environment}/gfs/data/latest.zarr",
},
}

nwp_key_list = list(all_nwps[region].keys()) + ["Other"]


def nwp_page():
"""Main page for pvsite forecast"""

Expand All @@ -75,13 +74,13 @@ def nwp_page():
)

# text input box
zarr_file = st.selectbox(
"Select the zarr file you want to explore", nwp_key_list
)
zarr_file = st.selectbox("Select the zarr file you want to explore", nwp_key_list)

if zarr_file in [None, "", "Other"]:
zarr_file = st.text_input(label="Or enter the zarr file you want to explore",
value=all_nwps[region][nwp_key_list[0]])
zarr_file = st.text_input(
label="Or enter the zarr file you want to explore",
value=all_nwps[region][nwp_key_list[0]],
)
else:
zarr_file = all_nwps[region][zarr_file]
st.text(f"Selected {zarr_file}")
Expand Down
26 changes: 13 additions & 13 deletions src/satellite_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@
environment = os.getenv("ENVIRONMENT", "development")


all_satellite = {
"uk": {
"0deg": f"s3://nowcasting-sat-{environment}/data/latest/latest.zarr.zip",
"0deg_HRV": f"s3://nowcasting-sat-{environment}/data/latest/hrv_latest.zarr.zip",
"9deg": f"s3://nowcasting-sat-{environment}/data/latest/15_latest.zarr.zip",
"9deg_HRV": f"s3://nowcasting-sat-{environment}/data/latest/15_hrv_latest.zarr.zip",
},
"india": {"45.5deg": f"s3://india-nwp-{environment}/data/latest/latest.zarr.zip"},
}

satellite_key_list = list(all_satellite[region].keys()) + ["Other"]


def get_data(zarr_file):

# hash filename
Expand Down Expand Up @@ -57,19 +70,6 @@ def get_data(zarr_file):
return ds


all_satellite = {
"UK": {
"0deg": f"s3://nowcasting-sat-{environment}/data/latest/latest.zarr.zip",
"0deg_HRV": f"s3://nowcasting-sat-{environment}/data/latest/hrv_latest.zarr.zip",
"9deg": f"s3://nowcasting-sat-{environment}/data/latest/15_latest.zarr.zip",
"9deg_HRV": f"s3://nowcasting-sat-{environment}/data/latest/15_hrv_latest.zarr.zip",
},
"INDIA": {"45.5deg": f"s3://india-nwp-{environment}/data/latest/latest.zarr.zip"},
}

satellite_key_list = list(all_satellite[region].keys()) + ["Other"]


def satellite_page():
"""Satellite pge"""

Expand Down

0 comments on commit f5fecfe

Please sign in to comment.