Skip to content

Commit

Permalink
removed duplicate variable specification
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewEichmann-NOAA committed Aug 7, 2023
1 parent 62ac75c commit 2e49be7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 38 deletions.
55 changes: 25 additions & 30 deletions scripts/exgdas_global_marine_analysis_vrfy.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
config = plotConfig(grid_file=grid_file,
data_file=data_file,
lats=np.arange(-60, 60, 10),
variables_zonal=['Temp', 'Salt'],
variables_horiz=['Temp', 'Salt', 'ave_ssh'],
allbounds={'Temp': [-0.5, 0.5],
'Salt': [-0.1, 0.1],
'ave_ssh': [-0.1, 0.1]},
variables_zonal={'Temp': [-0.5, 0.5],
'Salt': [-0.1, 0.1]},
variables_horiz={'Temp': [-0.5, 0.5],
'Salt': [-0.1, 0.1],
'ave_ssh': [-0.1, 0.1]},
colormap='RdBu',
comout=os.path.join(comout, 'vrfy', 'incr'))
ocnIncPlotter = statePlotter(config)
Expand All @@ -66,10 +66,9 @@
config = plotConfig(grid_file=grid_file,
data_file=data_file,
lats=np.arange(-60, 60, 10),
variables_horiz=['aicen', 'hicen', 'hsnon'],
allbounds={'aicen': [-0.2, 0.2],
'hicen': [-0.5, 0.5],
'hsnon': [-0.1, 0.1]},
variables_horiz={'aicen': [-0.2, 0.2],
'hicen': [-0.5, 0.5],
'hsnon': [-0.1, 0.1]},
colormap='RdBu',
projs=['North', 'South'],
comout=os.path.join(comout, 'vrfy', 'incr'))
Expand All @@ -83,10 +82,9 @@
data_file = os.path.join(comout, f'{RUN}.t'+cyc+'z.iceana.nc')
config = plotConfig(grid_file=grid_file,
data_file=data_file,
variables_horiz=['aicen', 'hicen', 'hsnon'],
allbounds={'aicen': [0.0, 1.0],
'hicen': [0.0, 4.0],
'hsnon': [0.0, 0.5]},
variables_horiz={'aicen': [0.0, 1.0],
'hicen': [0.0, 4.0],
'hsnon': [0.0, 0.5]},
colormap='jet',
projs=['North', 'South', 'Global'],
comout=os.path.join(comout, 'vrfy', 'ana'))
Expand All @@ -100,10 +98,9 @@
data_file = os.path.join(com_ice_history, f'{RUN}.t{gcyc}z.icef006.nc')
config = plotConfig(grid_file=grid_file,
data_file=data_file,
variables_horiz=['aice_h', 'hs_h', 'hi_h'],
allbounds={'aice_h': [0.0, 1.0],
'hs_h': [0.0, 4.0],
'hi_h': [0.0, 0.5]},
variables_horiz={'aice_h': [0.0, 1.0],
'hs_h': [0.0, 4.0],
'hi_h': [0.0, 0.5]},
colormap='jet',
projs=['North', 'South', 'Global'],
comout=os.path.join(comout, 'vrfy', 'bkg'))
Expand All @@ -117,10 +114,9 @@
data_file = os.path.join(comout, f'{RUN}.t'+cyc+'z.ocnana.nc')
config = plotConfig(grid_file=grid_file,
data_file=data_file,
variables_horiz=['ave_ssh', 'Temp', 'Salt'],
allbounds={'ave_ssh': [-1.8, 1.3],
'Temp': [-1.8, 34.0],
'Salt': [30, 38]},
variables_horiz={'ave_ssh': [-1.8, 1.3],
'Temp': [-1.8, 34.0],
'Salt': [30, 38]},
colormap='jet',
comout=os.path.join(comout, 'vrfy', 'ana'))
ocnAnaPlotter = statePlotter(config)
Expand All @@ -133,10 +129,9 @@
data_file = os.path.join(com_ocean_history, f'{RUN}.t{gcyc}z.ocnf006.nc')
config = plotConfig(grid_file=grid_file,
data_file=data_file,
variables_horiz=['ave_ssh', 'Temp', 'Salt'],
allbounds={'ave_ssh': [-1.8, 1.3],
'Temp': [-1.8, 34.0],
'Salt': [30, 38]},
variables_horiz={'ave_ssh': [-1.8, 1.3],
'Temp': [-1.8, 34.0],
'Salt': [30, 38]},
colormap='jet',
comout=os.path.join(comout, 'vrfy', 'bkg'))
ocnBkgPlotter = statePlotter(config)
Expand All @@ -150,11 +145,11 @@
config = plotConfig(grid_file=grid_file,
data_file=data_file,
lats=np.arange(-60, 60, 10),
variables_zonal=['Temp', 'Salt'],
variables_horiz=['Temp', 'Salt', 'ave_ssh'],
allbounds={'Temp': [0, 2],
'Salt': [0, 0.2],
'ave_ssh': [0, 0.1]},
variables_zonal={'Temp': [0, 2],
'Salt': [0, 0.2]},
variables_horiz={'Temp': [0, 2],
'Salt': [0, 0.2],
'ave_ssh': [0, 0.1]},
colormap='jet',
comout=os.path.join(comout, 'vrfy', 'bkgerr'))
bkgErrPlotter = statePlotter(config)
Expand Down
17 changes: 9 additions & 8 deletions ush/soca/soca_vrfy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ def plotConfig(grid_file=[],
data_file=[],
variable=[],
levels=[],
allbounds=[],
bounds=[],
colormap=[],
max_depth=np.nan,
max_depths=[700.0, 5000.0],
comout=[],
variables_horiz=[],
variables_zonal=[],
variables_horiz={},
variables_zonal={},
lat=np.nan,
lats=np.arange(-60, 60, 10),
proj='set me',
Expand All @@ -41,7 +40,6 @@ def plotConfig(grid_file=[],
config['fields file'] = data_file
config['levels'] = [1]
config['colormap'] = colormap
config['all bounds'] = allbounds
config['bounds'] = bounds
config['lats'] = lats # all the lats to plot
config['lat'] = lat # the lat being currently plotted
Expand Down Expand Up @@ -140,15 +138,18 @@ def plot(self):
for max_depth in self.config['max depths']:
self.config['max depth'] = max_depth

for variable in self.config['zonal variables']:
bounds = self.config['all bounds'][variable]
variableBounds = self.config['zonal variables']
for variable in variableBounds.keys():
bounds = variableBounds[variable]
self.config.update({'variable': variable, 'bounds': bounds})
plotZonalSlice(self.config)

#######################################
# Horizontal slices
for proj in self.config['projs']:
for variable in self.config['horiz variables']:
bounds = self.config['all bounds'][variable]

variableBounds = self.config['horiz variables']
for variable in variableBounds.keys():
bounds = variableBounds[variable]
self.config.update({'variable': variable, 'bounds': bounds, 'proj': proj})
plotHorizontalSlice(self.config)

0 comments on commit 2e49be7

Please sign in to comment.