Skip to content

esmf regridder fills in data where non should be #208

@doutriaux1

Description

@doutriaux1

I am not sure if this is a cdms2 or esmf problem.

when starting with a variable covering only part of the gobe and regidding it to a full globe, both regrid2 and libcf return the "expected" behaviour i.e set all ares that were not present originally to "missing".

In contrast esmf seems to do a filling of the data in the newly created space.

example test:

from __future__ import print_function
import cdms2
import unittest
import regrid2
import cdat_info


class ESMFHalfGlobe(unittest.TestCase):
    def setUp(self):
        self.clt = cdms2.open(cdat_info.get_sampledata_path()+"/clt.nc")("clt",latitude=(-90,0),time=slice(0,1),squeeze=1)
        self.T42 = cdms2.createGaussianGrid(64)

    def testRegrid2(self):
        reg = self.clt.regrid(self.T42,regridTool="regrid2")
        nmiss = 128*64-reg.count()
        print("REGRID2 Number of missing:",nmiss)

    def testEsmfLinear(self):
        reg = self.clt.regrid(self.T42,regridTool="esmf",regridMethod="linear")
        nmiss = 128*64-reg.count()
        print("ESMF Linear Number of missing:",nmiss)

    def testEsmfConservative(self):
        reg = self.clt.regrid(self.T42,regridTool="esmf",regridMethod="conservative")
        nmiss = 128*64-reg.count()
        print("ESMF Conservative Number of missing:",nmiss)

    def testlibcf(self):
        reg = self.clt.regrid(self.T42,regridTool="libcf")
        nmiss = 128*64-reg.count()
        print("libcf Number of missing:",nmiss)

produces:

RUNNNIG FROM: /var/folders/nv/3xl0t1xx4yxb6tyd0yqdm238001cpd/T/tmpyFdzCs
('Names:', ['/git/cdms/tests/test_EsmfHalfGlobe.py'])
Executing nosetests -s /git/cdms/tests/test_EsmfHalfGlobe.py in /private/var/folders/nv/3xl0t1xx4yxb6tyd0yqdm238001cpd/T/tmpyFdzCs
WARNING: Edge bounds are the same. The results of conservative regridding will not conserve.
coordMin =  -90.00, boundMin =  -90.00, coordMax =    0.00, boundMax =   -2.00
ESMF Conservative Number of missing: 0
.ESMF Linear Number of missing: 0
.REGRID2 Number of missing: 3968
./Users/doutriaux1/anaconda2/envs/nightly2/lib/python2.7/site-packages/cdms2/avariable.py:1152: Warning:
avariable.regrid: We chose regridMethod = linear for you among the following choices:
    'conserve' or 'linear' or 'patch'
  warnings.warn(message, Warning)
libcf Number of missing: 4224
.
----------------------------------------------------------------------
Ran 4 tests in 2.603s
OK
Ran 1 tests, 0 failed (100.00% success)

Note that ESMF regridding have 0 missing values.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions