Skip to content

Commit

Permalink
apply black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
blaylockbk committed Mar 21, 2022
1 parent d893fb3 commit b96ce71
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 43 deletions.
3 changes: 2 additions & 1 deletion herbie/accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 10 additions & 11 deletions herbie/models/ecmwf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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}"
3 changes: 2 additions & 1 deletion herbie/models/hrrr.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"""
from datetime import datetime


class hrrr:
def template(self):
self.DESCRIPTION = "High-Resolution Rapid Refresh - CONUS"
Expand Down Expand Up @@ -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,
}


Expand Down
9 changes: 5 additions & 4 deletions herbie/models/navgem.py
Original file line number Diff line number Diff line change
@@ -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}"
25 changes: 13 additions & 12 deletions herbie/models/nbm.py
Original file line number Diff line number Diff line change
@@ -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}"
3 changes: 2 additions & 1 deletion herbie/models/nexrad.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
👉🏻 https://nexradaws.readthedocs.io/en/latest/index.html
"""


class nexrad:
def template(self):
self.DESCRIPTION = "NEXRAD Radar "
Expand All @@ -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}"
1 change: 1 addition & 0 deletions herbie/models/rap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
27 changes: 14 additions & 13 deletions herbie/models/rrfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

0 comments on commit b96ce71

Please sign in to comment.