diff --git a/app/settings.py b/app/settings.py index 2b726a3..09dc910 100755 --- a/app/settings.py +++ b/app/settings.py @@ -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 +# 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 """ has_height_attr_names = { diff --git a/services/grib/service.py b/services/grib/service.py index 08072f4..d075302 100644 --- a/services/grib/service.py +++ b/services/grib/service.py @@ -41,7 +41,10 @@ class Grib: date_str = target_time.strftime("%Y%m%d") 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 @staticmethod @@ -63,7 +66,10 @@ class Grib: date_str = target_time.strftime("%Y%m%d") 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 @staticmethod