Skip to content

Regridding failures #73

@davidhassell

Description

@davidhassell
  • An exception is raised when regridding, with cf.Field.regrids from latitude-longitude to tripolar that seems to be unexpected
In [3]: import cf

In [4]: t = cf.read('global_tripolar.nc')[0]

In [5]: l = cf.read('global_lat_lon.nc')[0]

In [6]: print(t)
Field: sea_ice_area_fraction (ncvar%siconc)
-------------------------------------------
Data            : sea_ice_area_fraction(time(1), long_name=cell index along second dimension(330), long_name=cell index along first dimension(360)) %
Cell methods    : area: mean where sea time(1): mean
Dimension coords: time(1) = [1950-01-16 00:00:00] 360_day
                : long_name=cell index along second dimension(330) = [0, ..., 329] 1
                : long_name=cell index along first dimension(360) = [0, ..., 359] 1
Auxiliary coords: area_type(area_type(1)) = [b'sea_ice']
                : latitude(long_name=cell index along second dimension(330), long_name=cell index along first dimension(360)) = [[-84.10895538330078, ..., 50.01094055175781]] degrees_north
                : longitude(long_name=cell index along second dimension(330), long_name=cell index along first dimension(360)) = [[73.5, ..., 72.98915100097656]] degrees_east
Cell measures   : measure:area (external variable: ncvar%areacello)

In [7]: out = l.regrids(t, method='linear',
   ...:                 dst_axes={'X': 'ncdim%i', 'Y': 'ncdim%j'})
Traceback (most recent call last):
  File "delme2.py", line 8, in <module>
    out = l.regrids(t, method='linear', dst_axes={'X': 'ncdim%i', 'Y': 'ncdim%j'})
  File "/home/david/cf-python/cf/decorators.py", line 111, in precede_with_kwarg_deprecation_check
    operation_method_result = operation_method(self, *args, **kwargs)
  File "/home/david/cf-python/cf/decorators.py", line 41, in inplace_wrapper
    processed_copy = operation_method(self, *args, **kwargs)
  File "/home/david/cf-python/cf/field.py", line 18938, in regrids
    x = f.dimension_coordinate('X')
  File "/home/david/cf-python/cf/field.py", line 16321, in dimension_coordinate
    return c.value(default=default)
  File "/home/david/anaconda3/lib/python3.7/site-packages/cfdm/core/constructs.py", line 809, in value
    return self._default(default, "Can't return zero constructs")
  File "/home/david/anaconda3/lib/python3.7/site-packages/cfdm/core/constructs.py", line 332, in _default
    raise default
ValueError: Can't return zero constructs

In [8]:

  • A failure occurs with cf.Field.regrids when regridding to tripolar domains the do not have dimension coordinate constructs.

  • A failure occurs cf.Field.regrids and cf.Field.regridc when applying the destination mask (with use_dst_mask=True) to the regridded fields

In [8]: cf.environment(paths=False)
Platform: Linux-5.3.0-51-generic-x86_64-with-debian-buster-sid
HDF5 library: 1.10.4
netcdf library: 4.6.3
udunits2 library: libudunits2.so.0
python: 3.7.0
netCDF4: 1.5.3
cftime: 1.1.1
numpy: 1.15.1
psutil: 5.4.7
scipy: 1.1.0
matplotlib: 2.2.3
ESMF: 8.0.0
cfdm: 1.8.3
cfunits: 3.2.6
cfplot: not available
cf: 3.4.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions