Skip to content

Commit

Permalink
Merge pull request mom-ocean#59 from NOAA-GFDL/user/jpk/sea-ice-analy…
Browse files Browse the repository at this point in the history
…sis-fix

Added if-test for multiple area variable names

- Closes mom-ocean#58 .
  • Loading branch information
adcroft committed Nov 6, 2015
2 parents 221defe + b7cc806 commit d65ce31
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tools/analysis/Krasting-SeaIce.csh
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,13 @@ geolon = netCDF4.Dataset('gridspec/ocean_hgrid.nc').variables['x'][1::2,1::2]
geolat = netCDF4.Dataset('gridspec/ocean_hgrid.nc').variables['y'][1::2,1::2]
area_t = netCDF4.Dataset('gridspec/ocean_hgrid.nc').variables['area'][:].reshape((geolon.shape[0],2,geolon.shape[1],2)).sum(axis=1).sum(axis=-1)
#-- Read geolon/geolat
#-- Read yh/xh
if 'area_t' in netCDF4.Dataset('${oceanstaticfile}').variables: area_varname = 'area_t'
elif 'areacello' in netCDF4.Dataset('${oceanstaticfile}').variables: area_varname = 'areacello'
else: raise Exception('Could not find an area variable in the static grid file')
fs = cdms2.open('${oceanstaticfile}')
yh = fs('area_t').getAxis(0)
xh = fs('area_t').getAxis(1)
yh = fs(area_varname).getAxis(0)
xh = fs(area_varname).getAxis(1)
#-- Read data and compute climatology
f = cdms2.open('input.xml')
Expand Down

0 comments on commit d65ce31

Please sign in to comment.