ref: extract base url

dev
g 4 years ago
parent 8af53de5ad
commit f1b4853ca8

@ -11,6 +11,9 @@ SAVE_DIR = "/tmp/grib/" # don't forget to create it!
MAX_FORECAST_HOUR = 5 # 0-384 beware, each file is 500mb MAX_FORECAST_HOUR = 5 # 0-384 beware, each file is 500mb
# Base URL
GFS_BASE_URL = "https://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs"
# Globals with variable names and comments how to get them # Globals with variable names and comments how to get them
""" """
has_height_attr_names = { has_height_attr_names = {

@ -41,7 +41,10 @@ class Grib:
date_str = target_time.strftime("%Y%m%d") date_str = target_time.strftime("%Y%m%d")
hour_str = str((target_time.hour // 6) * 6).zfill(2) hour_str = str((target_time.hour // 6) * 6).zfill(2)
target_url = f"https://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs.{date_str}/{hour_str}/{looking_at}/gfs.t{hour_str}z.pgrb2.0p25.f{prod_hour}" target_url = (
GFS_BASE_URL
+ f".{date_str}/{hour_str}/{looking_at}/gfs.t{hour_str}z.pgrb2.0p25.f{prod_hour}"
)
return target_url return target_url
@staticmethod @staticmethod
@ -63,7 +66,10 @@ class Grib:
date_str = target_time.strftime("%Y%m%d") date_str = target_time.strftime("%Y%m%d")
hour_str = str((target_time.hour // 6) * 6).zfill(2) hour_str = str((target_time.hour // 6) * 6).zfill(2)
target_url = f"https://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs.{date_str}/{hour_str}/{looking_at}/gridded/gfs{looking_at}.t{hour_str}z.global.0p25.f{prod_hour}.grib2" target_url = (
GFS_BASE_URL
+ f".{date_str}/{hour_str}/{looking_at}/gridded/gfs{looking_at}.t{hour_str}z.global.0p25.f{prod_hour}.grib2"
)
return target_url return target_url
@staticmethod @staticmethod

Loading…
Cancel
Save