Skip to content

Commit 8c760f8

Browse files
authored
Merge pull request #910 from davidhassell/healpix
Implement HEALPix grids
2 parents 1c5fd27 + 335bb3e commit 8c760f8

Some content is hidden

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

42 files changed

+5220
-334
lines changed

Changelog.rst

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,21 @@ Version NEXTVERSION
33

44
**2026-??-??**
55

6+
* Support for HEALPix grids
7+
(https://github.com/NCAS-CMS/cf-python/issues/909)
8+
* New HEALPix methods: `cf.Field.healpix_info`,
9+
`cf.Field.healpix_decrease_refinement_level`,
10+
`cf.Field.healpix_increase_refinement_level`,
11+
`cf.Field.healpix_change_indexing_scheme`,
12+
`cf.Field.healpix_to_ugrid`, `cf.Domain.create_healpix`
13+
(https://github.com/NCAS-CMS/cf-python/issues/909)
14+
* New method: `cf.Field.create_latlon_coordinates`
15+
(https://github.com/NCAS-CMS/cf-python/issues/909)
16+
* New method: `cf.Data.coarsen`
17+
(https://github.com/NCAS-CMS/cf-python/issues/909)
18+
* New functions: `cf.locate`, `cf.healpix_max_refinement_level`,
19+
`cf.healpix_indexing_schemes`
20+
(https://github.com/NCAS-CMS/cf-python/issues/909)
621
* New keyword to `cf.read`: ``filesystem``
722
(https://github.com/NCAS-CMS/cf-python/issues/931)
823
* New keyword parameter to `cf.Data.compute`: ``persist``
@@ -24,7 +39,11 @@ Version NEXTVERSION
2439
(https://github.com/NCAS-CMS/cfdm/issues/391)
2540
* Fix for subspacing with cyclic `cf.wi` and `cf.wo` arguments
2641
(https://github.com/NCAS-CMS/cf-python/issues/887)
27-
* Changed dependency: ``cfdm>=1.13.1.0, <1.13.2.0``
42+
* New optional dependency: ``healpix>=2025.1``
43+
* New dependency: ``pyfive>=1.1.1``
44+
* Changed dependency: ``cfdm>=1.13.?.?, <1.13.?.0``
45+
46+
----
2847

2948
Version 3.19.0
3049
--------------
@@ -81,8 +100,8 @@ Version 3.18.1
81100
* Allow multiple conditions for the same axis in `cf.Field.subspace`
82101
and `cf.Field.indices`
83102
(https://github.com/NCAS-CMS/cf-python/issues/881)
84-
* Fix bug in `cf.Field.collapse` that causes a ``ValueError`` to be raised
85-
for missing external cell measures data
103+
* Fix bug in `cf.Field.collapse` that causes a ``ValueError`` to be
104+
raised for missing external cell measures data
86105
(https://github.com/NCAS-CMS/cf-python/issues/885)
87106
* New dependency: ``distributed>=2025.5.1``
88107
* Changed dependency: ``cfdm>=1.12.3.0, <1.12.4.0``

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ of its array manipulation and can:
9090
* write and append field and domain constructs to netCDF and Zarr v3
9191
datasets on disk, with control over HDF5 internal file metadata,
9292
* read, create, and manipulate UGRID mesh topologies,
93+
* read, write, and manipulate HEALPix grids,
9394
* read, write, and create coordinates defined by geometry cells,
9495
* read netCDF and CDL datasets containing hierarchical groups,
9596
* inspect field constructs,
@@ -105,11 +106,12 @@ of its array manipulation and can:
105106
* manipulate field construct data by arithmetical and trigonometrical
106107
operations,
107108
* perform weighted statistical collapses on field constructs,
108-
including those with geometry cells and UGRID mesh topologies,
109+
including those with geometry cells, UGRID mesh topologies, and
110+
HEALPix grids,
109111
* perform histogram, percentile and binning operations on field
110112
constructs,
111-
* regrid structured grid, mesh and DSG field constructs with
112-
(multi-)linear, nearest neighbour, first- and second-order
113+
* regrid structured grid, UGRID, HEALPix, and DSG field constructs
114+
with (multi-)linear, nearest neighbour, first- and second-order
113115
conservative and higher order patch recovery methods, including 3-d
114116
regridding, and large-grid support,
115117
* apply convolution filters to field constructs,

cf/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@
119119
from .tiepointindex import TiePointIndex
120120

121121
from .bounds import Bounds
122-
from .domain import Domain
123122
from .datum import Datum
124123
from .coordinateconversion import CoordinateConversion
125124

@@ -138,6 +137,7 @@
138137
from .cellconnectivity import CellConnectivity
139138
from .cellmethod import CellMethod
140139
from .cellmeasure import CellMeasure
140+
from .domain import Domain
141141
from .domainancillary import DomainAncillary
142142
from .domainaxis import DomainAxis
143143
from .domaintopology import DomainTopology

cf/cellconnectivity.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ class CellConnectivity(mixin.PropertiesData, cfdm.CellConnectivity):
4949
from any other sources, but is consistent with UGRID encoding
5050
within CF-netCDF.
5151
52-
See CF Appendix I "The CF Data Model".
52+
See CF Appendix I: The CF Data Model.
53+
https://doi.org/10.5281/zenodo.14274886
5354
5455
**NetCDF interface**
5556

cf/constants.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,31 @@
493493
},
494494
}
495495

496+
# --------------------------------------------------------------------
497+
# CF cell methods
498+
# --------------------------------------------------------------------
499+
cell_methods = set(
500+
(
501+
"point",
502+
"sum",
503+
"maximum",
504+
"maximum_absolute_value",
505+
"median",
506+
"mid_range",
507+
"minimum",
508+
"minimum_absolute_value",
509+
"mean",
510+
"mean_absolute_value",
511+
"mean_of_upper_decile",
512+
"mode",
513+
"range",
514+
"root_mean_square",
515+
"standard_deviation",
516+
"sum_of_squares",
517+
"variance",
518+
)
519+
)
520+
496521

497522
# --------------------------------------------------------------------
498523
# Logging level setup

cf/data/dask_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
"""Functions intended to be passed to be dask.
1+
"""Functions intended to be passed to be Dask.
22
3-
These will typically be functions that operate on dask chunks. For
3+
These will typically be functions that operate on Dask chunks. For
44
instance, as would be passed to `dask.array.map_blocks`.
55
66
"""
@@ -62,7 +62,7 @@ def cf_convolve1d(a, window=None, axis=-1, origin=0):
6262
6363
origin: `int`, optional
6464
Controls the placement of the filter on the input array’s
65-
pixels. A value of 0 (the default) centers the filter over
65+
pixels. A value of 0 (the default) centres the filter over
6666
the pixel, with positive values shifting the filter to the
6767
left, and negative ones to the right.
6868
@@ -165,7 +165,7 @@ def cf_percentile(a, q, axis, method, keepdims=False, mtol=1):
165165
if np.ma.isMA(a):
166166
# ------------------------------------------------------------
167167
# Input array is masked: Replace missing values with NaNs and
168-
# remask later.
168+
# re-mask later.
169169
# ------------------------------------------------------------
170170
if a.dtype != float:
171171
# Can't assign NaNs to integer arrays

0 commit comments

Comments
 (0)