Skip to content

Commit f6406ee

Browse files
authored
Merge pull request #698 from davidhassell/ugrid-0
Implementation of UGRID (part 1 of 2)
2 parents c131fdb + 2b98d54 commit f6406ee

File tree

90 files changed

+6281
-16491
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+6281
-16491
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
cf/test/dir/
1515
cf/test/*.nc
1616
cf/test/*.nca
17+
cf/test/*.cdl
1718
cf/test/*.txt
1819

1920
# coverage reports from a running the test coverage script

Changelog.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,24 @@ version 3.16.0
33

44
**2023-??-??**
55

6+
* Implemented the reading and manipulation of UGRID mesh topologies
7+
(https://github.com/NCAS-CMS/cf-python/issues/696)
8+
* New methods: `cf.Field.cell_connectivity`,
9+
`cf.Field.cell_connectivities`
10+
(https://github.com/NCAS-CMS/cf-python/issues/696)
11+
* New methods: `cf.Field.domain_topology`,
12+
`cf.Field.domain_topologies`
13+
(https://github.com/NCAS-CMS/cf-python/issues/696)
14+
* New method: `cf.Data.masked-values`
15+
(https://github.com/NCAS-CMS/cf-python/issues/696)
16+
* New method: `cf.Data.arctan2`
17+
(https://github.com/NCAS-CMS/cf-python/issues/38)
618
* Fix bug that caused `cf.Field.collapse` to give incorrect results
719
for the "sum", "sum_of_weights" and "sum_of_weights2" methods, only
820
in the case that weights have been requested
921
(https://github.com/NCAS-CMS/cf-python/issues/701)
22+
* Changed dependency: ``1.11.0.0<=cfdm<1.11.1.0``
23+
* New dependency: ``scipy>=1.10.0``
1024

1125
version 3.15.4
1226
--------------
@@ -283,8 +297,8 @@ version 3.11.0
283297
* Fix for `cf.aggregate` failures when a datum or coordinate
284298
conversion parameter has an array value
285299
(https://github.com/NCAS-CMS/cf-python/issues/230)
286-
* Allow for regridding using a destination field featuring size 1 dimension(s)
287-
(https://github.com/NCAS-CMS/cf-python/issues/250)
300+
* Allow for regridding using a destination field featuring size 1
301+
dimension(s) (https://github.com/NCAS-CMS/cf-python/issues/250)
288302
* Fix bug that sometimes caused `cf.Field.autocyclic` to fail when
289303
setting a construct that is cyclic and has a defined period
290304
* Fix bug that sometimes caused a failure when reading PP extra data

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ recursive-exclude cf *.o *.so *.a .nfs*
88
recursive-exclude cf/data *.rst
99
prune cf/test
1010
recursive-include cf/test __init__.py test_*.py
11-
recursive-include cf/test cfa_test.sh run_tests.py setup_create_field.py create_test_files.py individual_tests.sh
12-
recursive-include cf/test test_file.nc test_file[2-4].nc file.nc file[1-9].nc wgdos_packed.pp extra_data.pp file1.pp *.cdl
11+
recursive-include cf/test cfa_test.sh run_tests.py setup_create_field.py create_test_files*.py individual_tests.sh
12+
recursive-include cf/test test_file.nc test_file[2-4].nc file.nc file[1-9].nc ugrid_global_1.nc ugrid_global_2.nc wgdos_packed.pp extra_data.pp file1.pp *.cdl
1313
prune cf/test/dir

README.md

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -85,52 +85,34 @@ The `cf` package uses
8585
of its array manipulation and can:
8686

8787
* read field constructs from netCDF, CDL, PP and UM datasets,
88-
8988
* create new field constructs in memory,
90-
91-
* write and append field constructs to netCDF datasets on disk,
92-
89+
* write and append field and domain constructs to netCDF datasets on disk,
90+
* read, create, and manipulate UGRID mesh topologies,
9391
* read, write, and create coordinates defined by geometry cells,
94-
9592
* read netCDF and CDL datasets containing hierarchical groups,
96-
9793
* inspect field constructs,
98-
9994
* test whether two field constructs are the same,
100-
10195
* modify field construct metadata and data,
102-
10396
* create subspaces of field constructs,
104-
10597
* write field constructs to netCDF datasets on disk,
106-
10798
* incorporate, and create, metadata stored in external files,
108-
10999
* read, write, and create data that have been compressed by convention
110100
(i.e. ragged or gathered arrays, or coordinate arrays compressed by
111101
subsampling), whilst presenting a view of the data in its
112102
uncompressed form,
113-
114103
* combine field constructs arithmetically,
115-
116104
* manipulate field construct data by arithmetical and trigonometrical
117105
operations,
118-
119-
* perform statistical collapses on field constructs,
120-
106+
* perform weighted statistical collapses on field constructs,
107+
including those with geometry cells and UGRID mesh topologies,
121108
* perform histogram, percentile and binning operations on field
122109
constructs,
123-
124110
* regrid field constructs with (multi-)linear, nearest neighbour,
125111
first- and second-order conservative and higher order patch recovery
126-
methods,
127-
112+
methods, to and from structured and unstructured grids,
128113
* apply convolution filters to field constructs,
129-
130114
* create running means from field constructs,
131-
132115
* apply differential operators to field constructs,
133-
134116
* create derived quantities (such as relative vorticity).
135117

136118
Visualization

cf/__init__.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@
7373
7474
"""
7575

76-
__Conventions__ = "CF-1.10"
77-
__date__ = "2023-10-10"
78-
__version__ = "3.15.4"
76+
__Conventions__ = "CF-1.11"
77+
__date__ = "2023-??-??"
78+
__version__ = "3.16.0"
7979

8080
_requires = (
8181
"numpy",
@@ -86,6 +86,7 @@
8686
"psutil",
8787
"dask",
8888
"packaging",
89+
"scipy",
8990
)
9091

9192
x = ", ".join(_requires)
@@ -144,6 +145,11 @@
144145
except ImportError as error1:
145146
raise ImportError(_error0 + str(error1))
146147

148+
try:
149+
import scipy
150+
except ImportError as error1:
151+
raise ImportError(_error0 + str(error1))
152+
147153
# Check the version of packaging
148154
_minimum_vn = "20.0"
149155
if Version(packaging.__version__) < Version(_minimum_vn):
@@ -193,8 +199,8 @@
193199
)
194200

195201
# Check the version of cfdm
196-
_minimum_vn = "1.10.1.2"
197-
_maximum_vn = "1.10.2.0"
202+
_minimum_vn = "1.11.0.0"
203+
_maximum_vn = "1.11.1.0"
198204
_cfdm_version = Version(cfdm.__version__)
199205
if not Version(_minimum_vn) <= _cfdm_version < Version(_maximum_vn):
200206
raise RuntimeError(
@@ -218,6 +224,14 @@
218224
f"or later. Got {platform.python_version()}"
219225
)
220226

227+
# Check the version of scipy
228+
_minimum_vn = "1.10.0"
229+
if Version(scipy.__version__) < Version(_minimum_vn):
230+
raise RuntimeError(
231+
f"Bad scipy version: cf requires scipy>={_minimum_vn}. "
232+
f"Got {scipy.__version__} at {scipy.__file__}"
233+
)
234+
221235
from .constructs import Constructs
222236

223237
from .mixin import Coordinate
@@ -248,18 +262,23 @@
248262
from .dimensioncoordinate import DimensionCoordinate
249263
from .auxiliarycoordinate import AuxiliaryCoordinate
250264
from .coordinatereference import CoordinateReference
265+
from .cellconnectivity import CellConnectivity
251266
from .cellmethod import CellMethod
252267
from .cellmeasure import CellMeasure
253268
from .domainancillary import DomainAncillary
254269
from .domainaxis import DomainAxis
270+
from .domaintopology import DomainTopology
255271
from .fieldancillary import FieldAncillary
256272
from .field import Field
257273
from .data import Data
258274
from .data.array import (
275+
BoundsFromNodesArray,
276+
CellConnectivityArray,
259277
CFANetCDFArray,
260278
FullArray,
261279
GatheredArray,
262280
NetCDFArray,
281+
PointTopologyArray,
263282
RaggedContiguousArray,
264283
RaggedIndexedArray,
265284
RaggedIndexedContiguousArray,

0 commit comments

Comments
 (0)