Skip to content

Commit

Permalink
Add error handling for CS to CS comparison at different resolutions
Browse files Browse the repository at this point in the history
CS to CS regridding is not implemented in gcpy. Ref and dev at different
CS resolutions can only be compared on a lat-lon grid. This is an open
issue, but now there is error handling to exit out with a helpful message
if attempting to regrid CS to CS due to the comparison grid.

Signed-off-by: Lizzie Lundgren <elundgren@seas.harvard.edu>
  • Loading branch information
lizziel committed Aug 20, 2019
1 parent 4cc9c15 commit 4a2094d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions gcpy/benchmark.py
Expand Up @@ -244,7 +244,7 @@ def compare_single_level(refdata, refstr, devdata, devstr, varlist=None,
cmpgridtype = 'll'
else:
cmpgridtype = 'cs'

# Determine what, if any, need regridding.
regridref = refres != cmpres
regriddev = devres != cmpres
Expand Down Expand Up @@ -280,12 +280,20 @@ def compare_single_level(refdata, refstr, devdata, devstr, varlist=None,
if refgridtype == 'll':
refregridder = make_regridder_L2L(refres, cmpres, weightsdir=weightsdir, reuse_weights=True)
else:
refregridder_list = make_regridder_C2L(refres, cmpres, weightsdir=weightsdir, reuse_weights=True)
if cmpgridtype == 'cs':
print('ERROR: CS to CS regridding is not yet implemented in gcpy. Ref and dev cubed sphere grids must be the same resolution, or pass cmpres to compare_single_level as a lat-lon grid resolution.')
return
else:
refregridder_list = make_regridder_C2L(refres, cmpres, weightsdir=weightsdir, reuse_weights=True)
if regriddev:
if devgridtype == 'll':
devregridder = make_regridder_L2L(devres, cmpres, weightsdir=weightsdir, reuse_weights=True)
else:
devregridder_list = make_regridder_C2L(devres, cmpres, weightsdir=weightsdir, reuse_weights=True)
if cmpgridtype == 'cs':
print('ERROR: CS to CS regridding is not yet implemented in gcpy. Ref and dev cubed sphere grids must be the same resolution, or pass cmpres to compare_single_level as a lat-lon grid resolution.')
return
else:
devregridder_list = make_regridder_C2L(devres, cmpres, weightsdir=weightsdir, reuse_weights=True)

####################################################################
# Get lat/lon extents, if applicable
Expand Down

0 comments on commit 4a2094d

Please sign in to comment.