Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of UGRID (part 1 of 2) #698

Merged
merged 23 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
cf/test/dir/
cf/test/*.nc
cf/test/*.nca
cf/test/*.cdl
cf/test/*.txt

# coverage reports from a running the test coverage script
Expand Down
18 changes: 16 additions & 2 deletions Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,24 @@ version 3.16.0

**2023-??-??**

* Implemented the reading and manipulation of UGRID mesh topologies
(https://github.com/NCAS-CMS/cf-python/issues/696)
* New methods: `cf.Field.cell_connectivity`,
`cf.Field.cell_connectivities`
(https://github.com/NCAS-CMS/cf-python/issues/696)
* New methods: `cf.Field.domain_topology`,
`cf.Field.domain_topologies`
(https://github.com/NCAS-CMS/cf-python/issues/696)
* New method: `cf.Data.masked-values`
(https://github.com/NCAS-CMS/cf-python/issues/696)
* New method: `cf.Data.arctan2`
(https://github.com/NCAS-CMS/cf-python/issues/38)
* Fix bug that caused `cf.Field.collapse` to give incorrect results
for the "sum", "sum_of_weights" and "sum_of_weights2" methods, only
in the case that weights have been requested
(https://github.com/NCAS-CMS/cf-python/issues/701)
* Changed dependency: ``1.11.0.0<=cfdm<1.11.1.0``
* New dependency: ``scipy>=1.10.0``

version 3.15.4
--------------
Expand Down Expand Up @@ -283,8 +297,8 @@ version 3.11.0
* Fix for `cf.aggregate` failures when a datum or coordinate
conversion parameter has an array value
(https://github.com/NCAS-CMS/cf-python/issues/230)
* Allow for regridding using a destination field featuring size 1 dimension(s)
(https://github.com/NCAS-CMS/cf-python/issues/250)
* Allow for regridding using a destination field featuring size 1
dimension(s) (https://github.com/NCAS-CMS/cf-python/issues/250)
* Fix bug that sometimes caused `cf.Field.autocyclic` to fail when
setting a construct that is cyclic and has a defined period
* Fix bug that sometimes caused a failure when reading PP extra data
Expand Down
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ recursive-exclude cf *.o *.so *.a .nfs*
recursive-exclude cf/data *.rst
prune cf/test
recursive-include cf/test __init__.py test_*.py
recursive-include cf/test cfa_test.sh run_tests.py setup_create_field.py create_test_files.py individual_tests.sh
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
recursive-include cf/test cfa_test.sh run_tests.py setup_create_field.py create_test_files*.py individual_tests.sh
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
prune cf/test/dir
28 changes: 5 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,52 +85,34 @@ The `cf` package uses
of its array manipulation and can:

* read field constructs from netCDF, CDL, PP and UM datasets,

* create new field constructs in memory,

* write and append field constructs to netCDF datasets on disk,

* write and append field and domain constructs to netCDF datasets on disk,
* read, create, and manipulate UGRID mesh topologies,
* read, write, and create coordinates defined by geometry cells,

* read netCDF and CDL datasets containing hierarchical groups,

* inspect field constructs,

* test whether two field constructs are the same,

* modify field construct metadata and data,

* create subspaces of field constructs,

* write field constructs to netCDF datasets on disk,

* incorporate, and create, metadata stored in external files,

* read, write, and create data that have been compressed by convention
(i.e. ragged or gathered arrays, or coordinate arrays compressed by
subsampling), whilst presenting a view of the data in its
uncompressed form,

* combine field constructs arithmetically,

* manipulate field construct data by arithmetical and trigonometrical
operations,

* perform statistical collapses on field constructs,

* perform weighted statistical collapses on field constructs,
including those with geometry cells and UGRID mesh topologies,
* perform histogram, percentile and binning operations on field
constructs,

* regrid field constructs with (multi-)linear, nearest neighbour,
first- and second-order conservative and higher order patch recovery
methods,

methods, to and from structured and unstructured grids,
* apply convolution filters to field constructs,

* create running means from field constructs,

* apply differential operators to field constructs,

* create derived quantities (such as relative vorticity).

Visualization
Expand Down
29 changes: 24 additions & 5 deletions cf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@

"""

__Conventions__ = "CF-1.10"
__date__ = "2023-10-10"
__version__ = "3.15.4"
__Conventions__ = "CF-1.11"
__date__ = "2023-??-??"
__version__ = "3.16.0"

_requires = (
"numpy",
Expand All @@ -86,6 +86,7 @@
"psutil",
"dask",
"packaging",
"scipy",
)

x = ", ".join(_requires)
Expand Down Expand Up @@ -144,6 +145,11 @@
except ImportError as error1:
raise ImportError(_error0 + str(error1))

try:
import scipy
except ImportError as error1:
raise ImportError(_error0 + str(error1))

# Check the version of packaging
_minimum_vn = "20.0"
if Version(packaging.__version__) < Version(_minimum_vn):
Expand Down Expand Up @@ -193,8 +199,8 @@
)

# Check the version of cfdm
_minimum_vn = "1.10.1.2"
_maximum_vn = "1.10.2.0"
_minimum_vn = "1.11.0.0"
_maximum_vn = "1.11.1.0"
_cfdm_version = Version(cfdm.__version__)
if not Version(_minimum_vn) <= _cfdm_version < Version(_maximum_vn):
raise RuntimeError(
Expand All @@ -218,6 +224,14 @@
f"or later. Got {platform.python_version()}"
)

# Check the version of scipy
_minimum_vn = "1.10.0"
if Version(scipy.__version__) < Version(_minimum_vn):
raise RuntimeError(
f"Bad scipy version: cf requires scipy>={_minimum_vn}. "
f"Got {scipy.__version__} at {scipy.__file__}"
)

from .constructs import Constructs

from .mixin import Coordinate
Expand Down Expand Up @@ -248,18 +262,23 @@
from .dimensioncoordinate import DimensionCoordinate
from .auxiliarycoordinate import AuxiliaryCoordinate
from .coordinatereference import CoordinateReference
from .cellconnectivity import CellConnectivity
from .cellmethod import CellMethod
from .cellmeasure import CellMeasure
from .domainancillary import DomainAncillary
from .domainaxis import DomainAxis
from .domaintopology import DomainTopology
from .fieldancillary import FieldAncillary
from .field import Field
from .data import Data
from .data.array import (
BoundsFromNodesArray,
CellConnectivityArray,
CFANetCDFArray,
FullArray,
GatheredArray,
NetCDFArray,
PointTopologyArray,
RaggedContiguousArray,
RaggedIndexedArray,
RaggedIndexedContiguousArray,
Expand Down
Loading