grib2sail 0.3.0__tar.gz → 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {grib2sail-0.3.0 → grib2sail-0.3.1}/PKG-INFO +1 -1
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail/_version.py +3 -3
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail/downloader_arom.py +6 -1
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail/downloader_gfs.py +13 -12
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail.egg-info/PKG-INFO +1 -1
- {grib2sail-0.3.0 → grib2sail-0.3.1}/.github/release.yml +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/.github/workflows/release.yml +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/.gitignore +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/LICENSE +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/README.md +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/docs/assets/grib2sail_logo.png +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail/__init__.py +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail/__main__.py +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail/cli.py +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail/downloader.py +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail/logger.py +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail/token.py +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail/variables.py +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail/variables_arom.py +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail/variables_gfs.py +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail.egg-info/SOURCES.txt +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail.egg-info/dependency_links.txt +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail.egg-info/requires.txt +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/grib2sail.egg-info/top_level.txt +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/pyproject.toml +0 -0
- {grib2sail-0.3.0 → grib2sail-0.3.1}/setup.cfg +0 -0
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.3.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 3,
|
|
31
|
+
__version__ = version = '0.3.1'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 3, 1)
|
|
33
33
|
|
|
34
|
-
__commit_id__ = commit_id = '
|
|
34
|
+
__commit_id__ = commit_id = 'ga099d2dc0'
|
|
@@ -92,8 +92,12 @@ def download_arom(model, step, days, data, lat, lon):
|
|
|
92
92
|
logger.info('Sleeping 1 minute...')
|
|
93
93
|
t.sleep(60)
|
|
94
94
|
|
|
95
|
+
# Format output file name
|
|
96
|
+
run = latestRun.replace('-', '')
|
|
97
|
+
run = re.sub(r'T(00|06|12|18)\.00\.00Z', r'-\1z', run)
|
|
98
|
+
|
|
95
99
|
# Write the grib file as the concatenation of the layers
|
|
96
|
-
d.write_file(model,
|
|
100
|
+
d.write_file(model, run, step, layers)
|
|
97
101
|
|
|
98
102
|
def handle_fetch_error_arom(e):
|
|
99
103
|
if isinstance(e, requests.exceptions.HTTPError):
|
|
@@ -104,3 +108,4 @@ def handle_fetch_error_arom(e):
|
|
|
104
108
|
logger.debug(f"Error was {e}")
|
|
105
109
|
else:
|
|
106
110
|
logger.error_exit(f"Download failed: {e}")
|
|
111
|
+
|
|
@@ -6,10 +6,20 @@ import grib2sail.downloader as d
|
|
|
6
6
|
from grib2sail.logger import logger
|
|
7
7
|
|
|
8
8
|
def download_gfs(model, step, days, data, lat, lon):
|
|
9
|
+
if int(days) > 16:
|
|
10
|
+
logger.warning(f"Requesting {days} days, max is 16")
|
|
11
|
+
days = "16"
|
|
12
|
+
# Forecast is available on an hourly basis until day 5 then on a 3h basis
|
|
13
|
+
if step == '1h' and int(days) > 5 :
|
|
14
|
+
logger.warning('Only the first 5 days can have a step of 1h, the rest will have a 3h step')
|
|
15
|
+
hours = list(range(0, 120, 1)) + list(range(120, 385, 3))
|
|
16
|
+
else:
|
|
17
|
+
hours = list(range(0, 24 * int(days) + 1, int(step[:-1])))
|
|
18
|
+
|
|
9
19
|
session = d.get_session()
|
|
10
20
|
# Get latest available forecast date and run by trying from most recent
|
|
11
21
|
logger.info('Finding latest available forecast')
|
|
12
|
-
date, run = find_latest_forecast(session)
|
|
22
|
+
date, run = find_latest_forecast(session, f"f{hours[-1]:03d}")
|
|
13
23
|
logger.debug(f"Latest forecast is {date}, {run}z")
|
|
14
24
|
|
|
15
25
|
# Coverages list all the individual layers categories to download
|
|
@@ -21,15 +31,6 @@ def download_gfs(model, step, days, data, lat, lon):
|
|
|
21
31
|
coverages += [vg.GFS_DATAS[param]]
|
|
22
32
|
|
|
23
33
|
urls = []
|
|
24
|
-
if int(days) > 16:
|
|
25
|
-
logger.warning(f"Requesting {days} days, max is 16")
|
|
26
|
-
days = "16"
|
|
27
|
-
# Forecast is available on an hourly basis until day 5 then on a 3h basis
|
|
28
|
-
if step == '1h' and days > 5 :
|
|
29
|
-
logger.warning('Only the first 5 days can have a step of 1h, the rest will have a 3h step')
|
|
30
|
-
hours = list(range(0, 120, 1)) + list(range(120, 385, 3))
|
|
31
|
-
else:
|
|
32
|
-
hours = list(range(0, 24 * int(days) + 1, int(step[:-1])))
|
|
33
34
|
for hour in hours:
|
|
34
35
|
url = vg.API_URL
|
|
35
36
|
url += f"?dir=%2Fgfs.{date}%2F{run}%2Fatmos&file=gfs.t{run}z.pgrb2.0p25.f{hour:03d}"
|
|
@@ -42,7 +43,7 @@ def download_gfs(model, step, days, data, lat, lon):
|
|
|
42
43
|
# Write the grib file as the concatenation of the layers
|
|
43
44
|
d.write_file(model, f"{date}-{run}z", step, layers)
|
|
44
45
|
|
|
45
|
-
def find_latest_forecast(session):
|
|
46
|
+
def find_latest_forecast(session, lastLayer):
|
|
46
47
|
today = datetime.today()
|
|
47
48
|
dates = [
|
|
48
49
|
(today + timedelta(days=1)).strftime("%Y%m%d"),
|
|
@@ -54,7 +55,7 @@ def find_latest_forecast(session):
|
|
|
54
55
|
for run in runs:
|
|
55
56
|
url = (
|
|
56
57
|
f"{vg.PROD_URL}/gfs.{date}/{run}/atmos/"
|
|
57
|
-
f"gfs.t{run}z.pgrb2.0p25.
|
|
58
|
+
f"gfs.t{run}z.pgrb2.0p25.{lastLayer}"
|
|
58
59
|
)
|
|
59
60
|
try:
|
|
60
61
|
r = session.head(url, timeout=10)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|