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 Canadian Meterological Center Model Support #76

Merged
merged 18 commits into from
Dec 15, 2023
Merged
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ currently packaged with adapters for pulling and converting `.grib` data from:
- [CEDA Atmospheric Archive](https://catalogue.ceda.ac.uk)
- [ECMWF MARS API](https://apps.ecmwf.int/mars-catalogue)
- [DWD's ICON Model from the Opendata API](https://opendata.dwd.de)
- [CMC's GDPS Model from the Opendata API](https://dd.weather.gc.ca/)
jacobbieker marked this conversation as resolved.
Show resolved Hide resolved

Similarly, the service can write to multiple sinks:

Expand Down
7 changes: 7 additions & 0 deletions src/nwp_consumer/internal/config/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ class ICONEnv(EnvParser):
ICON_PARAMETER_GROUP: str = "default"


class CMCEnv(EnvParser):
"""Config for CMC API."""

CMC_MODEL: str = "gdps"
CMC_HOURS: int = 240
CMC_PARAMETER_GROUP: str = "full"

# --- Outputs environment variables --- #


Expand Down
5 changes: 3 additions & 2 deletions src/nwp_consumer/internal/inputs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
__all__ = ["ceda", "metoffice", "ecmwf", "icon"]
__all__ = ["ceda", "metoffice", "ecmwf", "icon", "cmc"]

from . import (
ceda,
metoffice,
ecmwf,
icon
icon,
cmc,
)
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions src/nwp_consumer/internal/inputs/cmc/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__all__ = ["Client"]

from .client import Client

62 changes: 62 additions & 0 deletions src/nwp_consumer/internal/inputs/cmc/_consts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
"""Defines all parameters available from GDPS."""


GDPS_VARIABLES = [
"ALBDO",
"ABSV",
"CWAT",
"TSOIL",
"SOILVIC",
"SOILM",
"SFCWRO",
"CAPE",
"CIN",
"ACPCP",
"DLWRF",
"DSWRF",
"HGT",
"FPRATE",
"IPRATE",
"PCPNTYPE",
"LHTFL",
"NLWRS",
"NSWRS",
"PRATE",
"PRES",
"RH",
"SKINT",
"SDEN",
"SNOD",
"SPRATE",
"SPFH",
"TMP",
"TCDC",
"APCP",
"ULWRF",
"VVEL",
"GUST",
"UGRD",
"VGRD",
]

GEPS_VARIABLES = [
"CAPE",
"CIN",
"HGT",
"ICETK",
"PRES",
"PRMSL",
"PWAT",
"RH",
"SCWRO",
"SNOD",
"SPFH",
"TCDC",
"TMP",
"TSOIL",
"UGRD",
"VGRD",
"WEASD",
"WIND",
"VVEL"
]
22 changes: 22 additions & 0 deletions src/nwp_consumer/internal/inputs/cmc/_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import datetime as dt

from nwp_consumer import internal


class CMCFileInfo(internal.FileInfoModel):
def __init__(
self, it: dt.datetime, filename: str, currentURL: str, step: int,
) -> "CMCFileInfo":
self._it = it
self._filename = filename
self._url = currentURL
self.step = step

def filename(self) -> str:
return self._filename

def filepath(self) -> str:
return self._url + "/" + self._filename

def it(self) -> dt.datetime:
return self._it
Loading