Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhassell committed Nov 4, 2024
2 parents 9f2c748 + 0c5af83 commit 047d915
Show file tree
Hide file tree
Showing 40 changed files with 18 additions and 111 deletions.
31 changes: 12 additions & 19 deletions Changelog.rst
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
version NEXTVERSION + 1
-----------------------

**2024-??-??**

* Allow access to netCDF-4 files in S3 object stores
(https://github.com/NCAS-CMS/cf-python/issues/712)
* New class `cf.H5netcdfArray`
* New class `cf.NetCDF4Array`
* New class `cf.CFAH5netcdfArray`
* New class `cf.CFANetCDF4Array`
* New dependency: ``h5netcdf>=1.3.0``
* New dependency: ``h5py>=3.10.0``
* New dependency: ``s3fs>=2024.2.0``
* Changed dependency: ``1.11.2.0<=cfdm<1.11.3.0``
* Changed dependency: ``cfunits>=3.3.7``

----

version NEXTVERSION
-------------------

Expand All @@ -33,6 +14,12 @@ version NEXTVERSION
* New keyword parameter to `cf.Field.derivative`:
``ignore_coordinate_units``
(https://github.com/NCAS-CMS/cf-python/issues/807)
* Allow access to netCDF-4 files in S3 object stores
(https://github.com/NCAS-CMS/cf-python/issues/712)
* New class `cf.H5netcdfArray`
* New class `cf.NetCDF4Array`
* New class `cf.CFAH5netcdfArray`
* New class `cf.CFANetCDF4Array`
* Fix bug that sometimes puts an incorrect ``radian-1`` or
``radian-2`` in the returned units of the differential operator
methods and functions
Expand All @@ -46,6 +33,12 @@ version NEXTVERSION
* Fix bug where `cf.normalize_slice` doesn't correctly
handle certain cyclic slices
(https://github.com/NCAS-CMS/cf-python/issues/774)
* New dependency: ``h5netcdf>=1.3.0``
* New dependency: ``h5py>=3.10.0``
* New dependency: ``s3fs>=2024.2.0``
* Changed dependency: ``1.11.2.0<=cfdm<1.11.3.0``
* Changed dependency: ``cfunits>=3.3.7``


----

Expand Down
4 changes: 0 additions & 4 deletions cf/cfimplementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
TiePointIndex,
)
from .data import Data

# REVIEW: h5: `cfimplementation.py`: import `CFAH5netcdfArray`, `CFANetCDF4Array`, `H5netcdfArray`,`NetCDF4Array`
from .data.array import (
BoundsFromNodesArray,
CellConnectivityArray,
Expand Down Expand Up @@ -116,7 +114,6 @@ def set_construct(self, parent, construct, axes=None, copy=True, **kwargs):
parent, construct, axes=axes, copy=copy, **kwargs
)

# REVIEW: h5: `initialise_CFANetCDF4Array`: new method to initialise `CFANetCDF4Array`
def initialise_CFANetCDF4Array(self, **kwargs):
"""Return a `CFANetCDF4Array` instance.
Expand All @@ -133,7 +130,6 @@ def initialise_CFANetCDF4Array(self, **kwargs):
cls = self.get_class("CFANetCDF4Array")
return cls(**kwargs)

# REVIEW: h5: `initialise_CFAH5netcdfArray`: new method to initialise `CFAH5netcdfArray`
def initialise_CFAH5netcdfArray(self, **kwargs):
"""Return a `CFAH5netcdfArray` instance.
Expand Down
1 change: 0 additions & 1 deletion cf/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"LOG_LEVEL": logging.getLevelName(logging.getLogger().level),
"BOUNDS_COMBINATION_MODE": "AND",
"CHUNKSIZE": parse_bytes(_CHUNKSIZE),
# REVIEW: active: `CONSTANTS`: new constants 'active_storage', 'active_storage_url', 'active_storage_max_requests'
"active_storage": False,
"active_storage_url": None,
"active_storage_max_requests": 100,
Expand Down
8 changes: 0 additions & 8 deletions cf/data/array/__init__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
from .boundsfromnodesarray import BoundsFromNodesArray
from .cellconnectivityarray import CellConnectivityArray

# REVIEW: h5: `__init__.py`: import `CFAH5netcdfArray`
from .cfah5netcdfarray import CFAH5netcdfArray

# REVIEW: h5: `__init__.py`: import `CFAH5netcdfArray`
from .cfanetcdf4array import CFANetCDF4Array
from .fullarray import FullArray
from .gatheredarray import GatheredArray

# REVIEW: h5: `__init__.py`: import `H5netcdfArray`
from .h5netcdfarray import H5netcdfArray
from .netcdfarray import NetCDFArray

# REVIEW: h5: `__init__.py`: import `NetCDF4Array`
from .netcdf4array import NetCDF4Array
from .pointtopologyarray import PointTopologyArray
from .raggedcontiguousarray import RaggedContiguousArray
Expand Down
1 change: 0 additions & 1 deletion cf/data/array/cfah5netcdfarray.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# REVIEW: h5: `CFAH5netcdfArray`: New class for accessing CFA with `h5netcdf`
from .h5netcdfarray import H5netcdfArray
from .mixin import CFAMixin

Expand Down
1 change: 0 additions & 1 deletion cf/data/array/cfanetcdf4array.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# REVIEW: h5: `CFAnetCDF4Array`: New class for accessing CFA with `netCDF4`
from .mixin import CFAMixin
from .netcdf4array import NetCDF4Array

Expand Down
3 changes: 0 additions & 3 deletions cf/data/array/fullarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class FullArray(IndexMixin, Array):
"""

# REVIEW: h5: `__init__`: replace units/calendar API with attributes
def __init__(
self,
fill_value=None,
Expand Down Expand Up @@ -121,7 +120,6 @@ def __str__(self):

return f"Filled with {fill_value!r}"

# REVIEW: getitem: `_get_array`: new method to convert subspace to numpy array
def _get_array(self, index=None):
"""Returns the full array.
Expand Down Expand Up @@ -156,7 +154,6 @@ def _get_array(self, index=None):

return array

# REVIEW: getitem: `array`: New property to convert subspace to numpy array
@property
def array(self):
"""Return an independent numpy array containing the data.
Expand Down
1 change: 0 additions & 1 deletion cf/data/array/h5netcdfarray.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# REVIEW: h5: `H5netcdfArray`: New class to access netCDF with `h5netcdf`
import cfdm

from ...mixin_container import Container
Expand Down
1 change: 0 additions & 1 deletion cf/data/array/locks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# REVIEW: h5: `locks.py`: New module to provide file locks
from dask.utils import SerializableLock

# Global lock for netCDF file access
Expand Down
3 changes: 0 additions & 3 deletions cf/data/array/mixin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# REVIEW: active: `__init__.py`: import `ActiveStorageMixin`
from .activestoragemixin import ActiveStorageMixin
from .arraymixin import ArrayMixin
from .cfamixin import CFAMixin
from .compressedarraymixin import CompressedArrayMixin
from .filearraymixin import FileArrayMixin

# REVIEW: getitem: `__init__.py`: import `IndexMixin`
from .indexmixin import IndexMixin
3 changes: 0 additions & 3 deletions cf/data/array/mixin/activestoragemixin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# REVIEW: active: `ActiveStorageMixin`: new mixin class `ActiveStorageMixin`


class ActiveStorageMixin:
"""Mixin class for enabling active storage operations.
Expand Down
1 change: 0 additions & 1 deletion cf/data/array/mixin/arraymixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def __array_function__(self, func, types, args, kwargs):
"""
return NotImplemented

# REVIEW: active: `_meta`: Moved to here from `FileArrayMixin`
@property
def _meta(self):
"""Normalise the array to an appropriate Dask meta object.
Expand Down
3 changes: 0 additions & 3 deletions cf/data/array/mixin/cfamixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def __new__(cls, *args, **kwargs):
}
return instance

# REVIEW: h5: `__init__`: replace units/calendar API with attributes
def __init__(
self,
filename=None,
Expand Down Expand Up @@ -224,7 +223,6 @@ def __init__(
"substitutions", substitutions.copy(), copy=False
)

# REVIEW: h5: `_parse_cfa`: Refactoring of code that used to be in `__init__`
def _parse_cfa(self, x, term, substitutions):
"""Parse the CFA aggregation instructions.
Expand Down Expand Up @@ -465,7 +463,6 @@ def get_fragment_shape(self):
"""
return self._get_component("fragment_shape")

# REVIEW: h5: `get_storage_options`: new method to get file access options
def get_storage_options(self):
"""Return `s3fs.S3FileSystem` options for accessing S3 fragment files.
Expand Down
1 change: 0 additions & 1 deletion cf/data/array/mixin/indexmixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from ....functions import indices_shape, parse_indices


# REVIEW: getitem: `IndexMixin`: new mixin class `IndexMixin`
class IndexMixin:
"""Mixin class for lazy indexing of a data array.
Expand Down
1 change: 0 additions & 1 deletion cf/data/array/netcdf4array.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# REVIEW: h5: `NetCDF4Array`: New class to access netCDF with `netCDF4`, replaces `NetCDFArray`
import cfdm

from ...mixin_container import Container
Expand Down
1 change: 0 additions & 1 deletion cf/data/array/netcdfarray.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# REVIEW: h5: `NetCDFArray`: Replaced by `NetCDF4Array`
class NetCDFArray:
"""A netCDF array accessed with `netCDF4`.
Expand Down
2 changes: 0 additions & 2 deletions cf/data/dask_regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import numpy as np

# REVIEW: getitem: `regrid.py`: import `cf_asanyarray`
from .dask_utils import cf_asanyarray


Expand Down Expand Up @@ -177,7 +176,6 @@ def regrid(
"""
weights, dst_mask = weights_dst_mask

# REVIEW: getitem: `regrid`: convert a to a usable array
a = cf_asanyarray(a)
if dst_mask is not None:
dst_mask = cf_asanyarray(dst_mask)
Expand Down
1 change: 1 addition & 0 deletions cf/data/dask_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ def cf_rt2dt(a, units):
"""
a = cfdm_asanyarray(a)

if not units.iscalendartime:
return rt2dt(a, units_in=units)

Expand Down
4 changes: 0 additions & 4 deletions cf/data/fragment/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
from .fullfragmentarray import FullFragmentArray

# REVIEW: h5: `__init__.py`: import `H5netcdfFragmentArray`
from .h5netcdffragmentarray import H5netcdfFragmentArray
from .netcdffragmentarray import NetCDFFragmentArray

# REVIEW: h5: `__init__.py`: import `NetCDF4FragmentArray`
from .netcdf4fragmentarray import NetCDF4FragmentArray
from .umfragmentarray import UMFragmentArray
1 change: 0 additions & 1 deletion cf/data/fragment/fullfragmentarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class FullFragmentArray(FragmentArrayMixin, FullArray):
"""

# REVIEW: h5: `__init__`: replace units/calendar API with attributes
def __init__(
self,
fill_value=None,
Expand Down
1 change: 0 additions & 1 deletion cf/data/fragment/h5netcdffragmentarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from .mixin import FragmentArrayMixin


# REVIEW: h5: `H5netcdfFragmentArray`: New class to access netCDF fragment with `h5netcdf`
class H5netcdfFragmentArray(FragmentArrayMixin, H5netcdfArray):
"""A netCDF fragment array accessed with `h5netcdf`.
Expand Down
2 changes: 0 additions & 2 deletions cf/data/fragment/mixin/fragmentarraymixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class FragmentArrayMixin:
"""

# REVIEW: getitem: `_get_array`: new method to convert subspace to numpy array
def _get_array(self, index=None):
"""Returns a subspace of the dataset variable.
Expand Down Expand Up @@ -166,7 +165,6 @@ def _size_1_axis(self, indices):
None
"""
# REVIEW: getitem: `_size_1_axis`: refactor to use `original_shape`
original_shape = self.original_shape
if original_shape.count(1):
return original_shape.index(1)
Expand Down
1 change: 0 additions & 1 deletion cf/data/fragment/netcdf4fragmentarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from .mixin import FragmentArrayMixin


# REVIEW: h5: `NetCDF4FragmentArray`: New class to access netCDF fragment with `netCDF4`
class NetCDF4FragmentArray(FragmentArrayMixin, NetCDF4Array):
"""A netCDF fragment array accessed with `netCDF4`.
Expand Down
3 changes: 0 additions & 3 deletions cf/data/fragment/netcdffragmentarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from .netcdf4fragmentarray import NetCDF4FragmentArray


# REVIEW: getitem: `NetCDFFragmentArray`: new inheritance to allow for different netCDF backends
class NetCDFFragmentArray(
FragmentArrayMixin,
IndexMixin,
Expand All @@ -24,7 +23,6 @@ class NetCDFFragmentArray(
"""

# REVIEW: h5: `__init__`: replace units/calendar API with attributes
def __init__(
self,
filename=None,
Expand Down Expand Up @@ -176,7 +174,6 @@ def __init__(
# By default, close the file after data array access
self._set_component("close", True, copy=False)

# REVIEW: getitem: `_get_array`: new method to convert subspace to numpy array
def _get_array(self, index=None):
"""Returns a subspace of the dataset variable.
Expand Down
2 changes: 0 additions & 2 deletions cf/data/fragment/umfragmentarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ class UMFragmentArray(FragmentArrayMixin, UMArray):
"""

# REVIEW: h5: `__init__`: replace units/calendar API with attributes
# REVIEW: h5: `__init__`: new keyword 'storage_options'
def __init__(
self,
filename=None,
Expand Down
1 change: 0 additions & 1 deletion cf/data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,6 @@ def parse_weights(d, weights, axis=None):
w = []
shape = d.shape
axes = d._axes

Data = type(d)
for key, value in weights.items():
value = Data.asdata(value)
Expand Down
2 changes: 0 additions & 2 deletions cf/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -5220,7 +5220,6 @@ def histogram(self, digitized):
"""
raise RuntimeError("Use cf.histogram instead.")

# REVIEW: active: active storage docstring
@_deprecated_kwarg_check("i", version="3.0.0", removed_at="4.0.0")
@_manage_log_level_via_verbosity
def collapse(
Expand Down Expand Up @@ -7101,7 +7100,6 @@ def collapse(
"collapse"
)

# REVIEW: active: `collapse`: include size 1 axes in collapse
# Note: It is important that size 1 axes are also passed
# on to the Data collapse, because active storage
# collapses get confused if they're not there.
Expand Down
Loading

0 comments on commit 047d915

Please sign in to comment.