Skip to content

Commit

Permalink
MPASglobal_test (#250)
Browse files Browse the repository at this point in the history
* Changes necessary to plot full domain images for the MPAS Global.  Corners are switched in gribdata.py to be compatible with the way the data are stored in the grib2 files.  Output is generated at 6h intervals, but some variables retain hourly accumulations.  These are handled in gribfile.py.

* Forgot to add the new yml file.
  • Loading branch information
Brian-Jamison authored Feb 18, 2025
1 parent 2220dea commit 605f1fc
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 6 deletions.
2 changes: 2 additions & 0 deletions adb_graphics/datahandler/gribdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@ def corners(self) -> list:
lat, lon = self.latlons()
if self.model in ['global', 'hfip', 'obs']:
ret = [lat[-1], lat[0], lon[0], lon[-1]]
elif self.model == 'global_mpas':
ret = [lat[0], lat[-1], lon[0], lon[-1]]
else:
ret = [lat[0, 0], lat[-1, -1], lon[0, 0], lon[-1, -1]]

Expand Down
18 changes: 16 additions & 2 deletions adb_graphics/datahandler/gribfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pylint: disable=invalid-name,too-few-public-methods,too-many-locals,too-many-branches
# pylint: disable=invalid-name,too-few-public-methods,too-many-locals,too-many-branches,too-many-statements

'''
Classes that load grib files.
Expand Down Expand Up @@ -99,7 +99,10 @@ def free_fcst_names(self, ds, fcst_type):
])
needs_renaming = var.split('_')[0] not in odd_variables
if suffix in special_suffixes and needs_renaming:
new_suffix = f'{suffix}1h' if 'global' not in self.model else f'{suffix}6h'
if 'global' not in self.model or self.model == 'global_mpas':
new_suffix = f'{suffix}1h'
else:
new_suffix = f'{suffix}6h'
ret[var] = var.replace(suffix, new_suffix)
# MASSDEN is a special case when ending in "avg_1'"
if var.split('_')[0] == 'MASSDEN' and var.split('_')[-2] == 'avg':
Expand Down Expand Up @@ -143,6 +146,17 @@ def free_fcst_names(self, ds, fcst_type):
print(f'dropping {var}')
ds.drop(var)
continue
# mpas_global has fields that have the suffix 'acc1h' but we don't
# want those since the output is 6h. Drop them if they come up.
bad_1h_vars = ['APCP_P8_L1_GLL0_acc1h', \
'FROZR_P8_L1_GLL0_acc1h', 'FRZR_P8_L1_GLL0_acc1h', \
'CDLYR_P8_L200_GLL0_avg1h', 'TCDC_P8_L200_GLL0_avg1h', \
'APCP_P8_L1_GLL0_acc1h', 'APCP_P8_L1_GST0_acc1h', \
'WEASD_P8_L1_GLL0_acc1h']
if self.model == 'global_mpas' and fhr != 0 and var in bad_1h_vars:
print(f'dropping {var}')
ds.drop(var)
continue
# For the RAP CONUS and AK domains, the APCP, WEASD, and FROZR
# variables all have 3h accumulation fields in addition to
# the 1h accumulation fields. This causes problems with the
Expand Down
12 changes: 10 additions & 2 deletions adb_graphics/default_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,15 @@ hail: # Max 1h Hail diameter
hailcast: # Max 1h Hail diameter
maxsfc: # surface, from HAILCAST
<<: *hail
ncl_name: HAIL_P8_L1_{grid}_max1h
title: Max 1h Hail Diameterat Sfc from HAILCAST
ncl_name:
global: HAIL_P8_L1_{grid}_max6h
global_mpas: HAIL_P8_L1_{grid}_max1h
hrrr: HAIL_P8_L1_{grid}_max1h
hrrrhi: HAIL_P8_L1_{grid}_max1h
hrrrcar: HAIL_P8_L1_{grid}_max1h
rap: HAIL_P8_L1_{grid}_max1h
rrfs: HAIL_P8_L1_{grid}_max1h
title: Max 6h Hail Diameter at Sfc from HAILCAST
hlcy: # Helicity
in16: &hlcy # Hourly updraft helicity over 1-6 km layer
clevs: !!python/object/apply:numpy.arange [25, 301, 25]
Expand Down Expand Up @@ -1199,6 +1206,7 @@ pres:
colors: pmsl_colors
ncl_name:
global: PRMSL_P0_L101_{grid}
global_mpas: MSLMA_P0_L101_{grid}
globalAK: PRMSL_P0_L101_{grid}
globalCONUS: PRMSL_P0_L101_{grid}
globalNHemi: PRMSL_P0_L101_{grid}
Expand Down
4 changes: 2 additions & 2 deletions adb_graphics/figures/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def _draw_field(self, ax, field, func, **kwargs):

# For global lat-lon models, make 2D arrays for x and y
# Shift the map and data if needed
if self.map.model in ['global', 'hfip']:
if self.map.model in ['global', 'global_mpas', 'hfip']:
tile = self.map.tile
if tile in ['Africa', 'Europe']:
vals, x = shiftgrid(180., vals, x, start=False)
Expand Down Expand Up @@ -909,7 +909,7 @@ def contours(self):
if self.map_type == 'enspanel':
return []

if self.model in ['global'] and self.tile in ['full']:
if 'global' in self.model and self.tile in ['full']:
return []

return self._overlay_fields('contours')
Expand Down
86 changes: 86 additions & 0 deletions image_lists/global_mpas.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
hourly:
model: global_mpas
variables:
1ref:
- 1000m
acpcp:
- sfc
cape:
- mu
- mul
- mx90mb
- sfc
ceil:
- ua
cin:
- sfc
cloudcover:
- high
- low
- mid
- total
cpofp:
- sfc
cref:
- sfc
dewp:
- 2m
gh:
- 500mb
gust:
- 10m
hailcast:
- maxsfc
hlcy:
- sr01
- sr03
hpbl:
- sfc
lhtfl:
- sfc
pres:
- msl
pwtr:
- sfc
rh:
- 2m
- 850mb
- mean
shtfl:
- sfc
snod:
- sfc
soilt: &soilt_levs
- 10cm
- 1m
soilw: *soilt_levs
temp:
- 2ds
- 2m
- 500mb
- 700mb
- 850mb
- 925mb
- sfc
totp:
- sfc
ulwrf:
- sfc
uswrf:
- sfc
vis:
- sfc
vort:
- 500mb
vvel:
- 700mb
weasd:
- sfc
wspeed:
- 10m
- 10mb
- 20mb
- 250mb
- 5mb
- 80m
- 850mb

0 comments on commit 605f1fc

Please sign in to comment.