From b96ce71361fb9f896b9352e41514fdaeea7ca62c Mon Sep 17 00:00:00 2001 From: Brian Blaylock Date: Mon, 21 Mar 2022 20:47:55 +0000 Subject: [PATCH] apply black formatting --- herbie/accessors.py | 3 ++- herbie/models/ecmwf.py | 21 ++++++++++----------- herbie/models/hrrr.py | 3 ++- herbie/models/navgem.py | 9 +++++---- herbie/models/nbm.py | 25 +++++++++++++------------ herbie/models/nexrad.py | 3 ++- herbie/models/rap.py | 1 + herbie/models/rrfs.py | 27 ++++++++++++++------------- 8 files changed, 49 insertions(+), 43 deletions(-) diff --git a/herbie/accessors.py b/herbie/accessors.py index 9e483e88..fe887e28 100644 --- a/herbie/accessors.py +++ b/herbie/accessors.py @@ -41,8 +41,9 @@ class HerbieAccessor: """ Accessor for xarray Datasets opened with Herbie - + """ + def __init__(self, xarray_obj): self._obj = xarray_obj self._center = None diff --git a/herbie/models/ecmwf.py b/herbie/models/ecmwf.py index 4b8167e2..b51d4a8f 100644 --- a/herbie/models/ecmwf.py +++ b/herbie/models/ecmwf.py @@ -19,8 +19,8 @@ class ecmwf: def template(self): # TODO: This will need to be updated someday - version = '0p4-beta' - #version = '0p4' + version = "0p4-beta" + # version = '0p4' self.DESCRIPTION = "ECMWF open data" self.DETAILS = { @@ -31,27 +31,26 @@ def template(self): "enfo": "ensemble forecast, atmospheric fields", "wave": "wave forecasts", "waef": "ensemble forecast, ocean wave fields,", - #"scda": "short cut-off high-resolution forecast, atmospheric fields (also known as high-frequency products)", - #"scwv": "short cut-off high-resolution forecast, ocean wave fields (also known as high-frequency products)", - #"mmsf": "multi-model seasonal forecasts fields from the ECMWF model only.", + # "scda": "short cut-off high-resolution forecast, atmospheric fields (also known as high-frequency products)", + # "scwv": "short cut-off high-resolution forecast, ocean wave fields (also known as high-frequency products)", + # "mmsf": "multi-model seasonal forecasts fields from the ECMWF model only.", } # example file # https://data.ecmwf.int/forecasts/20220126/00z/0p4-beta/oper/20220126000000-0h-oper-fc.grib2 # product suffix - if self.product in ['enfo', 'waef']: - product_suffix = 'ef' + if self.product in ["enfo", "waef"]: + product_suffix = "ef" else: - product_suffix = 'fc' + product_suffix = "fc" - post_root = f'{self.date:%Y%m%d/%Hz}/{version}/{self.product}/{self.date:%Y%m%d%H%M%S}-{self.fxx}h-{self.product}-{product_suffix}.grib2' + post_root = f"{self.date:%Y%m%d/%Hz}/{version}/{self.product}/{self.date:%Y%m%d%H%M%S}-{self.fxx}h-{self.product}-{product_suffix}.grib2" self.SOURCES = { "azure": f"https://ai4edataeuwest.blob.core.windows.net/ecmwf/{post_root}", "ecmwf": f"https://data.ecmwf.int/forecasts/{post_root}", - } self.IDX_SUFFIX = [".index"] - self.IDX_STYLE = 'eccodes' # 'wgrib2' or 'eccodes' + self.IDX_STYLE = "eccodes" # 'wgrib2' or 'eccodes' self.LOCALFILE = f"{self.get_remoteFileName}" diff --git a/herbie/models/hrrr.py b/herbie/models/hrrr.py index 137cfd74..37b92795 100644 --- a/herbie/models/hrrr.py +++ b/herbie/models/hrrr.py @@ -58,6 +58,7 @@ """ from datetime import datetime + class hrrr: def template(self): self.DESCRIPTION = "High-Resolution Rapid Refresh - CONUS" @@ -94,7 +95,7 @@ def template(self): # This requires an additional arg for `fxx_subh` when calling Herbie self.SOURCES = { "aws_old_subh": f"https://noaa-hrrr-bdp-pds.s3.amazonaws.com/hrrr.{self.date:%Y%m%d}/conus/hrrr.t{self.date:%H}z.wrf{self.product}f{self.fxx:02d}{self.fxx_subh:02d}.grib2", - **self.SOURCES + **self.SOURCES, } diff --git a/herbie/models/navgem.py b/herbie/models/navgem.py index 9b3724b5..3d0a65e6 100644 --- a/herbie/models/navgem.py +++ b/herbie/models/navgem.py @@ -1,16 +1,17 @@ ## Added by Brian Blaylock ## July 28, 2021 + class navgem: def template(self): - self.DESCRIPTION = 'Navy Global Environment Model' + self.DESCRIPTION = "Navy Global Environment Model" self.DETAILS = { - 'NRL description': 'https://www.nrlmry.navy.mil/metoc/nogaps/navgem.html', + "NRL description": "https://www.nrlmry.navy.mil/metoc/nogaps/navgem.html", } self.PRODUCTS = { - 'none': '', + "none": "", } self.SOURCES = { - 'nomads': f'https://nomads.ncep.noaa.gov/pub/data/nccf/com/fnmoc/prod/navgem.{self.date:%Y%m%d}/navgem_{self.date:%Y%m%d%H}f{self.fxx:03d}.grib2', + "nomads": f"https://nomads.ncep.noaa.gov/pub/data/nccf/com/fnmoc/prod/navgem.{self.date:%Y%m%d}/navgem_{self.date:%Y%m%d%H}f{self.fxx:03d}.grib2", } self.LOCALFILE = f"{self.get_remoteFileName}" diff --git a/herbie/models/nbm.py b/herbie/models/nbm.py index b168a736..0dc0305a 100644 --- a/herbie/models/nbm.py +++ b/herbie/models/nbm.py @@ -1,24 +1,25 @@ ## Added by Brian Blaylock ## July 27, 2021 + class nbm: def template(self): - self.DESCRIPTION = 'National Blend of Models' + self.DESCRIPTION = "National Blend of Models" self.DETAILS = { - 'NOMADS product description': 'https://www.nco.ncep.noaa.gov/pmb/products/blend/', - 'AWS Registry' : 'https://registry.opendata.aws/noaa-nbm/', - 'NWS National Blend of Models Home' : 'https://www.weather.gov/mdl/nbm_home', - 'MDL NBM Page': 'https://vlab.noaa.gov/web/mdl/nbm', + "NOMADS product description": "https://www.nco.ncep.noaa.gov/pmb/products/blend/", + "AWS Registry": "https://registry.opendata.aws/noaa-nbm/", + "NWS National Blend of Models Home": "https://www.weather.gov/mdl/nbm_home", + "MDL NBM Page": "https://vlab.noaa.gov/web/mdl/nbm", } self.PRODUCTS = { - 'ak': 'Alaska; 13-km resolution', - 'co': 'CONUS 13-km resolution', - 'gu': 'Guam 13-km resolution', - 'hi': 'Hawaii 13-km resolution', - 'pr': 'Puerto Rico 13-km resolution', + "ak": "Alaska; 13-km resolution", + "co": "CONUS 13-km resolution", + "gu": "Guam 13-km resolution", + "hi": "Hawaii 13-km resolution", + "pr": "Puerto Rico 13-km resolution", } self.SOURCES = { - 'nomads': f'https://nomads.ncep.noaa.gov/pub/data/nccf/com/blend/prod/blend.{self.date:%Y%m%d/%H}/core/blend.t{self.date:%H}z.core.f{self.fxx:03d}.{self.product}.grib2', - 'aws': f'https://noaa-nbm-grib2-pds.s3.amazonaws.com/blend.{self.date:%Y%m%d/%H}/core/blend.t{self.date:%H}z.core.f{self.fxx:03d}.{self.product}.grib2', + "nomads": f"https://nomads.ncep.noaa.gov/pub/data/nccf/com/blend/prod/blend.{self.date:%Y%m%d/%H}/core/blend.t{self.date:%H}z.core.f{self.fxx:03d}.{self.product}.grib2", + "aws": f"https://noaa-nbm-grib2-pds.s3.amazonaws.com/blend.{self.date:%Y%m%d/%H}/core/blend.t{self.date:%H}z.core.f{self.fxx:03d}.{self.product}.grib2", } self.LOCALFILE = f"{self.get_remoteFileName}" diff --git a/herbie/models/nexrad.py b/herbie/models/nexrad.py index b1f9352b..6b65506f 100644 --- a/herbie/models/nexrad.py +++ b/herbie/models/nexrad.py @@ -17,6 +17,7 @@ 👉🏻 https://nexradaws.readthedocs.io/en/latest/index.html """ + class nexrad: def template(self): self.DESCRIPTION = "NEXRAD Radar " @@ -30,5 +31,5 @@ def template(self): "aws": f"https://noaa-nexrad-{self.product}.s3.amazonaws.com/{self.date:%Y/%m/%d}/{self.station}/{self.station}{self.date:%Y%m%d_%H%M%S}_V06", "aws-old": f"https://noaa-nexrad-{self.product}.s3.amazonaws.com/{self.date:%Y/%m/%d}/{self.station}/{self.station}{self.date:%Y%m%d_%H%M%S}", } - self.EXPECT_IDX_FILE = 'none' + self.EXPECT_IDX_FILE = "none" self.LOCALFILE = f"{self.get_remoteFileName}" diff --git a/herbie/models/rap.py b/herbie/models/rap.py index baf01d9f..1ee22a2d 100644 --- a/herbie/models/rap.py +++ b/herbie/models/rap.py @@ -48,6 +48,7 @@ def template(self): # TODO: Set LOCALFILE name to match modern filename structure. + class rap_historical: """ The RAP and RUC historical record at NCEI. (files older than 2020) diff --git a/herbie/models/rrfs.py b/herbie/models/rrfs.py index 24081861..5bb92ad4 100644 --- a/herbie/models/rrfs.py +++ b/herbie/models/rrfs.py @@ -3,27 +3,28 @@ # NOTE: The Rapid Refresh Forecast System is rapidly changing + class rrfs: def template(self): - self.DESCRIPTION = 'Rapid Refresh Forecast System (RRFS) Ensemble' + self.DESCRIPTION = "Rapid Refresh Forecast System (RRFS) Ensemble" self.DETAILS = { - 'aws product description': 'https://registry.opendata.aws/noaa-rrfs/', + "aws product description": "https://registry.opendata.aws/noaa-rrfs/", } self.PRODUCTS = { # Below are ensemble products found in ensprod/ - 'mean' : 'ensemble mean', - 'avrg' : 'ensemble products: ???', - 'eas' : 'ensemble products: ???', - 'ffri' : 'ensemble products: ???', - 'lpmm' : 'ensemble products: ???', - 'pmmn' : 'ensemble products: ???', - 'prob' : 'ensemble products: ???', + "mean": "ensemble mean", + "avrg": "ensemble products: ???", + "eas": "ensemble products: ???", + "ffri": "ensemble products: ???", + "lpmm": "ensemble products: ???", + "pmmn": "ensemble products: ???", + "prob": "ensemble products: ???", # Below are member products found in mem##/ - 'testbed.conus': 'surface grids (one for each member)', - 'na': 'native grids (one for each member)', + "testbed.conus": "surface grids (one for each member)", + "na": "native grids (one for each member)", } self.SOURCES = { - 'aws' : f'https://noaa-rrfs-pds.s3.amazonaws.com/rrfs.{self.date:%Y%m%d/%H}/ensprod/rrfsce.t{self.date:%H}z.conus.{self.product}.f{self.fxx:02d}.grib2', - 'aws-mem' : f'https://noaa-rrfs-pds.s3.amazonaws.com/rrfs.{self.date:%Y%m%d/%H}/mem{self.member:02d}/rrfs.t{self.date:%H}z.mem{self.member:02d}.{self.product}f{self.fxx:03d}.grib2', + "aws": f"https://noaa-rrfs-pds.s3.amazonaws.com/rrfs.{self.date:%Y%m%d/%H}/ensprod/rrfsce.t{self.date:%H}z.conus.{self.product}.f{self.fxx:02d}.grib2", + "aws-mem": f"https://noaa-rrfs-pds.s3.amazonaws.com/rrfs.{self.date:%Y%m%d/%H}/mem{self.member:02d}/rrfs.t{self.date:%H}z.mem{self.member:02d}.{self.product}f{self.fxx:03d}.grib2", } self.LOCALFILE = f"mem{self.member:02d}/{self.get_remoteFileName}"