From d9c123914994aaf901cce66766924ad57a4c484c Mon Sep 17 00:00:00 2001 From: Paolo Davini <p.davini@isac.cnr.it> Date: Thu, 17 Oct 2024 16:54:01 +0200 Subject: [PATCH] some more tests --- smmregrid/checker.py | 16 ++++++++-------- tests/basic_test.py | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/smmregrid/checker.py b/smmregrid/checker.py index c9659b9..76cfbfd 100644 --- a/smmregrid/checker.py +++ b/smmregrid/checker.py @@ -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 @@ -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': diff --git a/tests/basic_test.py b/tests/basic_test.py index 0fa5706..142c8c0 100644 --- a/tests/basic_test.py +++ b/tests/basic_test.py @@ -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()