Skip to content

Commit

Permalink
Merge pull request #826 from davidhassell/REVIEW
Browse files Browse the repository at this point in the history
Remove REVIEW comments
  • Loading branch information
davidhassell authored Oct 30, 2024
2 parents c734c0c + ac981dd commit fb741f2
Show file tree
Hide file tree
Showing 39 changed files with 0 additions and 174 deletions.
3 changes: 0 additions & 3 deletions cf/cfimplementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
)
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 +115,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 +131,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
3 changes: 0 additions & 3 deletions 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 Expand Up @@ -49,8 +48,6 @@ def _lock(self):
"""
return netcdf_lock

# REVIEW: h5: `_get_array`: Ignore this for h5 review
# 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
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 @@ -36,7 +36,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 @@ -225,7 +224,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 @@ -466,7 +464,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
3 changes: 0 additions & 3 deletions 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 Expand Up @@ -47,8 +46,6 @@ def _lock(self):
"""
return netcdf_lock

# REVIEW: getitem: `_get_array`: Ignore this for h5 review
# 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
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
5 changes: 0 additions & 5 deletions cf/data/array/umarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class UMArray(
):
"""A sub-array stored in a PP or UM fields file."""

# REVIEW: h5: `__init__`: replace units/calendar API with attributes
def __init__(
self,
filename=None,
Expand Down Expand Up @@ -171,7 +170,6 @@ def __init__(
# By default, close the UM 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 Expand Up @@ -272,7 +270,6 @@ def _get_rec(self, f, header_offset):
# if r.hdr_offset == header_offset:
# return r

# REVIEW: getitem: `_set_FillValue`: record _FillValue in attributes
def _set_FillValue(self, int_hdr, real_hdr, attributes):
"""Set the ``_FillValue`` attribute.
Expand Down Expand Up @@ -367,10 +364,8 @@ def _set_units(self, int_hdr, attributes):
units = units0
break

# REVIEW: getitem: `_set_units`: record units in attributes
attributes["units"] = units

# REVIEW: getitem: `_set_unpack`: record unpack in attributes
def _set_unpack(self, int_hdr, real_hdr, attributes):
"""Set the ``add_offset`` and ``scale_factor`` attributes.
Expand Down
1 change: 0 additions & 1 deletion cf/data/collapse/collapse_active.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# REVIEW: active: `collapse_active.py`: new module for active storage functionality
import datetime
import logging
import time
Expand Down
12 changes: 0 additions & 12 deletions cf/data/collapse/dask_collapse.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# REVIEW: active: `dask_collapse.py`: all unlabelled changes in this module are general tidying, and should be reviewed at the same time as active storage
"""Reduction functions intended to be passed to be dask.
Most of these functions are expected to be passed to
Expand Down Expand Up @@ -231,7 +230,6 @@ def sum_sample_sizes(pairs, axis, computing_meta=False, **kwargs):
# --------------------------------------------------------------------
# mean
# --------------------------------------------------------------------
# REVIEW: active: `cf_mean_chunk`: active storage decoration
@actify("mean")
def cf_mean_chunk(
x,
Expand Down Expand Up @@ -378,7 +376,6 @@ def cf_mean_agg(
# --------------------------------------------------------------------
# maximum
# --------------------------------------------------------------------
# REVIEW: active: `cf_max_chunk`: active storage decoration
@actify("max")
def cf_max_chunk(x, dtype=None, computing_meta=False, **kwargs):
"""Chunk calculations for the maximum.
Expand Down Expand Up @@ -533,7 +530,6 @@ def cf_mid_range_agg(
# --------------------------------------------------------------------
# minimum
# --------------------------------------------------------------------
# REVIEW: active: `cf_min_chunk`: active storage decoration
@actify("min")
def cf_min_chunk(x, dtype=None, computing_meta=False, **kwargs):
"""Chunk calculations for the minimum.
Expand Down Expand Up @@ -640,7 +636,6 @@ def cf_min_agg(
# --------------------------------------------------------------------
# range
# --------------------------------------------------------------------
# REVIEW: active: `cf_range_chunk`: active storage decoration
@actify("range")
def cf_range_chunk(x, dtype=None, computing_meta=False, **kwargs):
"""Chunk calculations for the range.
Expand Down Expand Up @@ -754,7 +749,6 @@ def cf_range_agg(
# --------------------------------------------------------------------
# root mean square
# --------------------------------------------------------------------
# REVIEW: active: `cf_rms_chunk`: active storage decoration
@actify("rms")
def cf_rms_chunk(x, weights=None, dtype="f8", computing_meta=False, **kwargs):
"""Chunk calculations for the root mean square (RMS).
Expand Down Expand Up @@ -839,7 +833,6 @@ def cf_rms_agg(
# --------------------------------------------------------------------
# sample size
# --------------------------------------------------------------------
# REVIEW: active: `cf_sample_size_chunk`: active storage decoration
@actify("sample_size")
def cf_sample_size_chunk(x, dtype="i8", computing_meta=False, **kwargs):
"""Chunk calculations for the sample size.
Expand Down Expand Up @@ -953,7 +946,6 @@ def cf_sample_size_agg(
# --------------------------------------------------------------------
# sum
# --------------------------------------------------------------------
# REVIEW: active: `cf_sum_chunk`: active storage decoration
@actify("sum")
def cf_sum_chunk(
x,
Expand Down Expand Up @@ -1089,7 +1081,6 @@ def cf_sum_agg(
# --------------------------------------------------------------------
# sum of weights
# --------------------------------------------------------------------
# REVIEW: active: `cf_sum_of_weights_chunk`: active storage decoration
@actify("sum_of_weights")
def cf_sum_of_weights_chunk(
x, weights=None, dtype="f8", computing_meta=False, **kwargs
Expand Down Expand Up @@ -1133,7 +1124,6 @@ def cf_sum_of_weights_chunk(
# --------------------------------------------------------------------
# sum of squares of weights
# --------------------------------------------------------------------
# REVIEW: active: `cf_sum_of_weights2_chunk`: active storage decoration
@actify("sum_of_weights2")
def cf_sum_of_weights2_chunk(
x, weights=None, dtype="f8", computing_meta=False, **kwargs
Expand Down Expand Up @@ -1179,7 +1169,6 @@ def cf_sum_of_weights2_chunk(
# --------------------------------------------------------------------
# unique
# --------------------------------------------------------------------
# REVIEW: active: `cf_unique_chunk`: active storage decoration
@actify("unique")
def cf_unique_chunk(x, dtype=None, computing_meta=False, **kwargs):
"""Chunk calculations for the unique values.
Expand Down Expand Up @@ -1244,7 +1233,6 @@ def cf_unique_agg(pairs, axis=None, computing_meta=False, **kwargs):
# --------------------------------------------------------------------
# variance
# --------------------------------------------------------------------
# REVIEW: active: `cf_var_chunk`: active storage decoration
@actify("var")
def cf_var_chunk(
x, weights=None, dtype="f8", computing_meta=False, ddof=None, **kwargs
Expand Down
3 changes: 0 additions & 3 deletions cf/data/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def to_dask(array, chunks, **from_array_options):
if is_dask_collection(array):
return array

# REVIEW: getitem: `to_dask`: set '_asanyarray'
if hasattr(array, "to_dask_array"):
try:
return array.to_dask_array(chunks=chunks)
Expand All @@ -83,8 +82,6 @@ def to_dask(array, chunks, **from_array_options):
array = np.asanyarray(array)

kwargs = from_array_options
# REVIEW: active: `to_dask`: '_dask_meta' renamed to '_meta' for consistency with Dask
# REVIEW: getitem: `to_dask`: The file lock is now on the `Array` object (in its `_get_array` method), rather than being set on the Dask array itself.
kwargs.setdefault("meta", getattr(array, "_meta", None))

try:
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
Loading

0 comments on commit fb741f2

Please sign in to comment.