Skip to content

Commit

Permalink
some more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oloapinivad committed Oct 17, 2024
1 parent c22e9d1 commit d9c1239
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions smmregrid/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ def check_cdo_regrid(finput, ftarget, remap_method='con', access='Dataset',
smmvar = find_var(xfield)
cdovar = find_var(cdofield)

if len(smmvar) == 1 and access == 'DataArray':
xfield = xfield[smmvar[0]]
if len(cdovar) == 1 and access == 'DataArray':
cdofield = cdofield[cdovar[0]]
#if len(smmvar) == 1 and access == 'DataArray':
# xfield = xfield[smmvar[0]]
#if len(cdovar) == 1 and access == 'DataArray':
# cdofield = cdofield[cdovar[0]]

# interpolation with smmregrid (CDO-based)
# method with creation of weights
Expand Down Expand Up @@ -98,10 +98,10 @@ def check_cdo_regrid_levels(finput, ftarget, vertical_dim, levels, remap_method=
smmvar = find_var(xfield)
cdovar = find_var(cdofield)

if len(smmvar) == 1 and access == 'DataArray':
xfield = xfield[smmvar[0]]
if len(cdovar) == 1 and access == 'DataArray':
cdofield = cdofield[cdovar[0]]
#if len(smmvar) == 1 and access == 'DataArray':
# xfield = xfield[smmvar[0]]
#if len(cdovar) == 1 and access == 'DataArray':
# cdofield = cdofield[cdovar[0]]

# compute weights
if vertical_dim == 'plev':
Expand Down
2 changes: 1 addition & 1 deletion tests/basic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ def test_nan_preserve(method):
xfield = xarray.open_mfdataset(os.path.join(INDIR, 'tas-ecearth.nc'))
xfield['tas'][1,:,:] = numpy.nan
wfield = cdo_generate_weights(xfield, tfile, method = method, loglevel='debug')
interpolator = Regridder(weights=wfield, loglevel='debug')
interpolator = Regridder(weights=wfield, space_dims='pippo', loglevel='debug')
rfield = interpolator.regrid(xfield)
assert numpy.isnan(rfield['tas'][1,:,:]).all().compute()

0 comments on commit d9c1239

Please sign in to comment.