-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
77 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
from dagster import Definitions, load_assets_from_modules | ||
from nwp import assets, jobs | ||
from nwp import defs | ||
|
||
def test_compiles(): | ||
all_assets = load_assets_from_modules([assets]) | ||
defs = Definitions( | ||
assets=all_assets, | ||
jobs=jobs.asset_jobs, | ||
schedules=jobs.schedule_jobs | ||
) | ||
job_names = [d.name for d in list(defs.get_all_job_defs())] | ||
assert "get_ecmwf_data" in job_names | ||
assert len(job_names) == 18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
from nwp.assets.dwd.archive_to_hf import download_model_files, process_model_files, upload_model_files_to_hf | ||
from nwp.assets.ecmwf.mars import download_mars_file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,32 @@ | ||
from dagster_docker import execute_docker_container | ||
from dagster import Config, OpExecutionContext, op | ||
import datetime as dt | ||
|
||
from dagster import Output, asset | ||
from ecmwfapi import ECMWFService | ||
|
||
server = ECMWFService("mars") | ||
class NWPConsumerConfig(Config): | ||
date_from: str | ||
date_to: str | ||
source: str | ||
|
||
|
||
@asset | ||
def download_mars_file(): | ||
server.execute( | ||
req={ | ||
"class": "od", | ||
"date": "20230815/to/20230816", | ||
"expver": "1", | ||
"levtype": "sfc", | ||
"param": "28.228/49.128/123.128/165.128/166.128/239.228/246.228/247.228", | ||
"step": "0/t0/48/by/1", | ||
"stream": "oper", | ||
"time": "00:00:00,12:00:00", | ||
"type": "fc", | ||
}, | ||
target="20230815.grib" | ||
@op | ||
def nwp_consumer_docker_op(context: OpExecutionContext, config: NWPConsumerConfig): | ||
execute_docker_container( | ||
context=context, | ||
image="ghcr.io/openclimatefix/nwp-consumer", | ||
command=[ | ||
"consume", f'--source={config.source}', | ||
f'--from={config.date_from}', | ||
f'--to={config.date_to}' | ||
], | ||
env_vars=["ECMWF_API_KEY", "ECMWF_API_URL", "ECMWF_API_EMAIL"], | ||
container_kwargs={ | ||
"volumes": [ | ||
'/mnt/storage_b/data/ocf/solar_pv_nowcasting/nowcasting_dataset_pipeline/NWP/ECMWF/raw:/tmp/raw', | ||
'/mnt/storage_b/data/ocf/solar_pv_nowcasting/nowcasting_dataset_pipeline/NWP/ECMWF/zarr:/tmp/zarr', | ||
'/tmp/nwpc:/tmp/nwpc' | ||
] | ||
} | ||
) | ||
|
||
return Output(None, metadata={"filepath": "20230815.grib"}) | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters