Skip to content

The cf.Field.has_construct method returns False unless a construct key is used #67

@davidhassell

Description

@davidhassell
In [12]: import cf

In [13]: f = cf.example_field(0)

In [14]: print(f.constructs)
Constructs:
{'cellmethod0': <CF CellMethod: area: mean>,
 'dimensioncoordinate0': <CF DimensionCoordinate: latitude(5) degrees_north>,
 'dimensioncoordinate1': <CF DimensionCoordinate: longitude(8) degrees_east>,
 'dimensioncoordinate2': <CF DimensionCoordinate: time(1) days since 2018-12-01 >,
 'domainaxis0': <CF DomainAxis: size(5)>,
 'domainaxis1': <CF DomainAxis: size(8)>,
 'domainaxis2': <CF DomainAxis: size(1)>}

In [15]: f.has_construct('dimensioncoordinate2')
Out[15]: True

In [16]: f.has_construct('T')
Out[16]: False

We should have:

>>> f.has_construct('T')
True
  • The version of the software and the environment in which you are encountering an issue. The output of cf.environment(paths=False) is useful for this.
Platform: Linux-5.3.0-46-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.3
netCDF4: 1.5.3
cftime: 1.1.1
numpy: 1.18.1
psutil: 5.4.7
scipy: 1.4.1
matplotlib: 3.2.0
ESMF: 8.0.0
cfdm: 1.8.1
cfunits: 3.2.6
cfplot: not available
cf: 3.3.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