Skip to content

Commit 402df25

Browse files
authored
Merge pull request #1071 from irenavankova/add_fris_comparison_grids
Add FRIS comparison grid
2 parents e33a335 + 737f5c2 commit 402df25

File tree

4 files changed

+47
-16
lines changed

4 files changed

+47
-16
lines changed

mpas_analysis/default.cfg

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,11 @@ comparisonSubpolarNorthAtlanticWidth = 7000.
262262
comparisonSubpolarNorthAtlanticHeight = 4000.
263263
comparisonSubpolarNorthAtlanticResolution = 20.
264264

265+
# The comparison FRIS Antarctic polar stereographic grid size and resolution in km
266+
comparisonFrisBounds = [-1800., -400., 100., 1500.]
267+
# comparisonFrisWidth = 6000.
268+
comparisonFrisResolution = 10.
269+
265270
# interpolation order for model and observation results. Likely values are
266271
# 'bilinear', 'neareststod' (nearest neighbor) or 'conserve'
267272
mpasInterpolationMethod = bilinear
@@ -500,6 +505,21 @@ useCartopyCoastline = True
500505
latLines = np.arange(-80., 81., 10.)
501506
lonLines = np.arange(-180., 181., 30.)
502507

508+
[plot_fris]
509+
## options related to FRIS Antarctic projection plots
510+
511+
# figure sizes for different numbers of panels and layouts
512+
onePanelFigSize = (8, 8.5)
513+
threePanelVertFigSize = (8, 22)
514+
threePanelHorizFigSize = (22, 7.5)
515+
516+
# whether to use the cartopy coastline (as opposed to the model coastline)
517+
useCartopyCoastline = True
518+
519+
# latitude and longitude grid lines
520+
latLines = np.arange(-80., 81., 10.)
521+
lonLines = np.arange(-180., 181., 30.)
522+
503523
[html]
504524
## options related to generating a webpage to display the analysis
505525

mpas_analysis/shared/climatology/comparison_descriptors.py

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def get_comparison_descriptor(config, comparison_grid_name):
3434
Contains configuration options
3535
3636
comparison_grid_name : {'latlon', 'antarctic', 'arctic', 'north_atlantic',
37-
'north_pacific', 'subpolar_north_atlantic'}
37+
'north_pacific', 'subpolar_north_atlantic', 'fris'}
3838
The name of the comparison grid to use for remapping.
3939
4040
Raises
@@ -125,15 +125,17 @@ def _get_projection_comparison_descriptor(config, comparison_grid_name):
125125
'arctic_extended': 'ArcticExtended',
126126
'north_atlantic': 'NorthAtlantic',
127127
'north_pacific': 'NorthPacific',
128-
'subpolar_north_atlantic': 'SubpolarNorthAtlantic'}
128+
'subpolar_north_atlantic': 'SubpolarNorthAtlantic',
129+
'fris': 'Fris'}
129130

130131
grid_suffixes = {'antarctic': 'Antarctic_stereo',
131132
'arctic': 'Arctic_stereo',
132133
'antarctic_extended': 'Antarctic_stereo',
133134
'arctic_extended': 'Arctic_stereo',
134135
'north_atlantic': 'North_Atlantic',
135136
'north_pacific': 'North_Pacific',
136-
'subpolar_north_atlantic': 'Subpolar_North_Atlantic'}
137+
'subpolar_north_atlantic': 'Subpolar_North_Atlantic',
138+
'fris': 'Fris'}
137139

138140
if comparison_grid_name not in option_suffixes:
139141
raise ValueError(f'{comparison_grid_name} is not one of the supported '
@@ -143,23 +145,32 @@ def _get_projection_comparison_descriptor(config, comparison_grid_name):
143145

144146
option_suffix = option_suffixes[comparison_grid_name]
145147
grid_suffix = grid_suffixes[comparison_grid_name]
146-
width = config.getfloat(
147-
section, f'comparison{option_suffix}Width')
148-
option = f'comparison{option_suffix}Height'
148+
option = f'comparison{option_suffix}Bounds'
149149
if config.has_option(section, option):
150-
height = config.getfloat(section, option)
150+
bounds = config.getexpression(section, option)
151+
bounds = [1e3 * bound for bound in bounds]
151152
else:
152-
height = width
153+
width = config.getfloat(
154+
section, f'comparison{option_suffix}Width')
155+
option = f'comparison{option_suffix}Height'
156+
157+
if config.has_option(section, option):
158+
height = config.getfloat(section, option)
159+
else:
160+
height = width
161+
xmax = 0.5 * width * 1e3
162+
ymax = 0.5 * height * 1e3
163+
bounds = [-xmax, xmax, -ymax, ymax]
164+
width = (bounds[1] - bounds[0]) / 1e3
165+
height = (bounds[3] - bounds[2]) / 1e3
153166
res = config.getfloat(
154167
section, f'comparison{option_suffix}Resolution')
155168

156-
xmax = 0.5 * width * 1e3
157169
nx = int(width / res) + 1
158-
x = numpy.linspace(-xmax, xmax, nx)
170+
x = numpy.linspace(bounds[0], bounds[1], nx)
159171

160-
ymax = 0.5 * height * 1e3
161172
ny = int(height / res) + 1
162-
y = numpy.linspace(-ymax, ymax, ny)
173+
y = numpy.linspace(bounds[2], bounds[3], ny)
163174

164175
mesh_name = f'{width}x{height}km_{res}km_{grid_suffix}'
165176
descriptor = ProjectionGridDescriptor.create(projection, x, y, mesh_name)

mpas_analysis/shared/projection/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
known_comparison_grids = ['latlon', 'antarctic', 'antarctic_extended',
1717
'arctic', 'arctic_extended', 'north_atlantic',
18-
'north_pacific', 'subpolar_north_atlantic']
18+
'north_pacific', 'subpolar_north_atlantic', 'fris']
1919

2020

2121
def get_pyproj_projection(comparison_grid_name):
@@ -49,7 +49,7 @@ def get_pyproj_projection(comparison_grid_name):
4949

5050
if comparison_grid_name == 'latlon':
5151
raise ValueError('latlon is not a projection grid.')
52-
elif comparison_grid_name in ['antarctic', 'antarctic_extended']:
52+
elif comparison_grid_name in ['antarctic', 'antarctic_extended', 'fris']:
5353
projection = pyproj.Proj(
5454
'+proj=stere +lat_ts=-71.0 +lat_0=-90 +lon_0=0.0 +k_0=1.0 '
5555
'+x_0=0.0 +y_0=0.0 +ellps=WGS84')
@@ -105,7 +105,7 @@ def get_cartopy_projection(comparison_grid_name):
105105
if comparison_grid_name == 'latlon':
106106
raise ValueError('latlon is not a projection grid.')
107107

108-
elif comparison_grid_name in ['antarctic', 'antarctic_extended']:
108+
elif comparison_grid_name in ['antarctic', 'antarctic_extended', 'fris']:
109109
projection = cartopy.crs.Stereographic(
110110
central_latitude=-90., central_longitude=0.0,
111111
true_scale_latitude=-71.0)

suite/template.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,4 @@ usePostprocessingScript = True
146146

147147
# comparison grid(s) ('latlon', 'antarctic') on which to plot analysis
148148
comparisonGrids = ['latlon', 'antarctic', 'arctic', 'north_atlantic',
149-
'north_pacific']
149+
'north_pacific', 'fris']

0 commit comments

Comments
 (0)