Skip to content

Commit

Permalink
Merge pull request #62 from Ingenjorsarbete-For-Klimatet/hotfix/stran…
Browse files Browse the repository at this point in the history
…g-date-types

Hotfix/strang date types
  • Loading branch information
mgcth authored Feb 17, 2023
2 parents ab6bed1 + fb4c124 commit 6be598b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/smhi/constants.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Constans."""
import arrow
import logging
from datetime import datetime
from collections import defaultdict
from posixpath import join as urljoin
from typing import NamedTuple, Optional, Callable
Expand All @@ -9,7 +10,7 @@
logging.basicConfig(level=logging.INFO, format="%(message)s")


def get_now():
def get_now() -> datetime:
"""
Get current datetime.
Expand Down Expand Up @@ -57,7 +58,7 @@ def get_now():
[
("parameter", Optional[int]),
("meaning", Optional[str]),
("time_from", Optional[arrow.Arrow]),
("time_from", Optional[datetime]),
("time_to", Callable),
],
)
Expand All @@ -66,37 +67,37 @@ def get_now():
STRANG_PARAMETERS[116] = STRANG(
116,
"CIE UV irradiance [mW/m²]",
arrow.get("1999-01-01"),
arrow.get("1999-01-01").datetime,
get_now,
)

STRANG_PARAMETERS[117] = STRANG(
117,
"Global irradiance [W/m²]",
arrow.get("1999-01-01"),
arrow.get("1999-01-01").datetime,
get_now,
)
STRANG_PARAMETERS[118] = STRANG(
118,
"Direct normal irradiance [W/m²]",
arrow.get("1999-01-01"),
arrow.get("1999-01-01").datetime,
get_now,
)
STRANG_PARAMETERS[120] = STRANG(
120,
"PAR [W/m²]",
arrow.get("1999-01-01"),
arrow.get("1999-01-01").datetime,
get_now,
)
STRANG_PARAMETERS[121] = STRANG(
121,
"Direct horizontal irradiance [W/m²]",
arrow.get("2017-04-18"),
arrow.get("2017-04-18").datetime,
get_now,
)
STRANG_PARAMETERS[122] = STRANG(
122,
"Diffuse irradiance [W/m²]",
arrow.get("2017-04-18"),
arrow.get("2017-04-18").datetime,
get_now,
)

0 comments on commit 6be598b

Please sign in to comment.