Skip to content

Commit

Permalink
Make client instantiation in function
Browse files Browse the repository at this point in the history
  • Loading branch information
devsjc committed Oct 20, 2023
1 parent d275da2 commit 0a8bcd8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nwp/assets/cams/cams.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import cdsapi
import dagster

c = cdsapi.Client()

VARIABLES: list[str] = [
'aerosol_extinction_coefficient_1064nm', 'aerosol_extinction_coefficient_355nm', 'aerosol_extinction_coefficient_532nm',
Expand Down Expand Up @@ -79,6 +78,9 @@ class CAMSConfig(dagster.Config):
@dagster.op
def fetch_cams_forecast_for_day(context: dagster.OpExecutionContext, config: CAMSConfig):
"""Fetch CAMS forecast for a given day."""

c = cdsapi.Client()

date: dt.datetime = dt.datetime.strptime(config.date, "%Y-%m-%d")

if date < dt.datetime(2015, 1, 1):
Expand Down

0 comments on commit 0a8bcd8

Please sign in to comment.