Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
108 changes: 0 additions & 108 deletions cf/domain.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from math import prod
from os import sep

import cfdm
import numpy as np
Expand All @@ -14,7 +13,6 @@
from .functions import (
_DEPRECATION_ERROR_ARG,
_DEPRECATION_ERROR_METHOD,
abspath,
indices_shape,
parse_indices,
)
Expand Down Expand Up @@ -125,43 +123,6 @@ def size(self):
[domain_axis.get_size(0) for domain_axis in domain_axes.values()]
)

def add_file_location(
self,
location,
):
"""Add a new file location in-place.
All data definitions that reference files are additionally
referenced from the given location.
.. versionadded:: 3.15.0
.. seealso:: `del_file_location`, `file_locations`
:Parameters:
location: `str`
The new location.
:Returns:
`str`
The new location as an absolute path with no trailing
path name component separator.
**Examples**
>>> f.add_file_location('/data/model/')
'/data/model'
"""
location = abspath(location).rstrip(sep)

for c in self.constructs.filter_by_data(todict=True).values():
c.add_file_location(location)

return location

def close(self):
"""Close all files referenced by the domain construct.
Expand All @@ -188,43 +149,6 @@ def close(self):
removed_at="5.0.0",
) # pragma: no cover

def del_file_location(
self,
location,
):
"""Remove a file location in-place.
All data definitions that reference files will have references
to files in the given location removed from them.
.. versionadded:: 3.15.0
.. seealso:: `add_file_location`, `file_locations`
:Parameters:
location: `str`
The file location to remove.
:Returns:
`str`
The removed location as an absolute path with no
trailing path name component separator.
**Examples**
>>> d.del_file_location('/data/model/')
'/data/model'
"""
location = abspath(location).rstrip(sep)

for c in self.constructs.filter_by_data(todict=True).values():
c.del_file_location(location)

return location

@classmethod
def create_regular(cls, x_args, y_args, bounds=True):
"""
Expand Down Expand Up @@ -333,38 +257,6 @@ def create_regular(cls, x_args, y_args, bounds=True):

return domain

def file_locations(
self,
):
"""The locations of files containing parts of the components data.
Returns the locations of any files that may be required to
deliver the computed data arrays of any of the component
constructs (such as dimension coordinate constructs, cell
measure constructs, etc.).
.. versionadded:: 3.15.0
.. seealso:: `add_file_location`, `del_file_location`
:Returns:
`set`
The unique file locations as absolute paths with no
trailing path name component separator.
**Examples**
>>> d.file_locations()
{'/home/data1', 'file:///data2'}
"""
out = set()
for c in self.constructs.filter_by_data(todict=True).values():
out.update(c.file_locations())

return out

@_inplace_enabled(default=False)
def flip(self, axes=None, inplace=False):
"""Flip (reverse the direction of) domain axes.
Expand Down
20 changes: 11 additions & 9 deletions docs/source/class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ Field list class

cf.FieldList

Domain class
------------

.. autosummary::
:nosignatures:
:toctree: class/

cf.Domain

Metadata component classes
--------------------------

Expand All @@ -32,12 +41,14 @@ Metadata component classes
:toctree: class/

cf.AuxiliaryCoordinate
cf.CellConnectivity
cf.CellMeasure
cf.CellMethod
cf.CoordinateReference
cf.DimensionCoordinate
cf.DomainAncillary
cf.DomainAxis
cf.DomainTopology
cf.FieldAncillary

Constructs class
Expand All @@ -60,15 +71,6 @@ Coordinate component classes
cf.CoordinateConversion
cf.Datum

Domain class
------------

.. autosummary::
:nosignatures:
:toctree: class/

cf.Domain

Data classes
------------

Expand Down
20 changes: 11 additions & 9 deletions docs/source/class/cf.AuxiliaryCoordinate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,8 @@ Groups
~cf.AuxiliaryCoordinate.nc_set_variable_groups
~cf.AuxiliaryCoordinate.nc_clear_variable_groups

CFA
---
Aggregation
-----------

.. rubric:: Methods

Expand All @@ -530,13 +530,8 @@ CFA
:toctree: ../method/
:template: method.rst

~cf.AuxiliaryCoordinate.add_file_location
~cf.AuxiliaryCoordinate.cfa_clear_file_substitutions
~cf.AuxiliaryCoordinate.cfa_del_file_substitution
~cf.AuxiliaryCoordinate.cfa_file_substitutions
~cf.AuxiliaryCoordinate.cfa_update_file_substitutions
~cf.AuxiliaryCoordinate.del_file_location
~cf.AuxiliaryCoordinate.file_locations
~cf.AuxiliaryCoordinate.file_directories
~cf.AuxiliaryCoordinate.replace_directory

Aliases
-------
Expand Down Expand Up @@ -721,11 +716,18 @@ Deprecated
:toctree: ../method/
:template: method.rst

~cf.AuxiliaryCoordinate.add_file_location
~cf.AuxiliaryCoordinate.asdatetime
~cf.AuxiliaryCoordinate.asreftime
~cf.AuxiliaryCoordinate.cfa_clear_file_substitutions
~cf.AuxiliaryCoordinate.cfa_del_file_substitution
~cf.AuxiliaryCoordinate.cfa_file_substitutions
~cf.AuxiliaryCoordinate.cfa_update_file_substitutions
~cf.AuxiliaryCoordinate.chunk
~cf.AuxiliaryCoordinate.del_file_location
~cf.AuxiliaryCoordinate.delprop
~cf.AuxiliaryCoordinate.expand_dims
~cf.AuxiliaryCoordinate.file_locations
~cf.AuxiliaryCoordinate.files
~cf.AuxiliaryCoordinate.get_filenames
~cf.AuxiliaryCoordinate.getprop
Expand Down
21 changes: 12 additions & 9 deletions docs/source/class/cf.Bounds.rst
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,8 @@ NetCDF
~cf.Bounds.nc_hdf5_chunksizes
~cf.Bounds.nc_set_hdf5_chunksizes

CFA
---
Aggregation
-----------

.. rubric:: Methods

Expand All @@ -428,13 +428,8 @@ CFA
:toctree: ../method/
:template: method.rst

~cf.Bounds.add_file_location
~cf.Bounds.cfa_clear_file_substitutions
~cf.Bounds.cfa_del_file_substitution
~cf.Bounds.cfa_file_substitutions
~cf.Bounds.cfa_update_file_substitutions
~cf.Bounds.del_file_location
~cf.Bounds.file_locations
~cf.Bounds.file_directories
~cf.Bounds.replace_directory

Aliases
-------
Expand Down Expand Up @@ -632,13 +627,21 @@ Deprecated
:toctree: ../method/
:template: method.rst


~cf.Bounds.add_file_location
~cf.Bounds.asdatetime
~cf.Bounds.asreftime
~cf.Bounds.attributes
~cf.Bounds.cfa_clear_file_substitutions
~cf.Bounds.cfa_del_file_substitution
~cf.Bounds.cfa_file_substitutions
~cf.Bounds.cfa_update_file_substitutions
~cf.Bounds.chunk
~cf.Bounds.del_file_location
~cf.Bounds.delprop
~cf.Bounds.dtvarray
~cf.Bounds.expand_dims
~cf.Bounds.file_locations
~cf.Bounds.getprop
~cf.Bounds.get_filenames
~cf.Bounds.hasbounds
Expand Down
58 changes: 58 additions & 0 deletions docs/source/class/cf.BoundsFromNodesArray.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
.. currentmodule:: cf
.. default-role:: obj

cf.BoundsFromNodesArray
=======================

----

.. autoclass:: cf.BoundsFromNodesArray
:no-members:
:no-inherited-members:

.. rubric:: Methods

.. autosummary::
:nosignatures:
:toctree: ../method/
:template: method.rst

~cf.BoundsFromNodesArray.__init__
~cf.BoundsFromNodesArray.compressed_dimensions
~cf.BoundsFromNodesArray.conformed_data
~cf.BoundsFromNodesArray.copy
~cf.BoundsFromNodesArray.get_attributes
~cf.BoundsFromNodesArray.get_Subarray
~cf.BoundsFromNodesArray.get_calendar
~cf.BoundsFromNodesArray.get_cell_dimension
~cf.BoundsFromNodesArray.get_compressed_axes
~cf.BoundsFromNodesArray.get_compressed_dimension
~cf.BoundsFromNodesArray.get_compression_type
~cf.BoundsFromNodesArray.get_filenames
~cf.BoundsFromNodesArray.get_node_coordinates
~cf.BoundsFromNodesArray.get_start_index
~cf.BoundsFromNodesArray.get_subspace
~cf.BoundsFromNodesArray.get_units
~cf.BoundsFromNodesArray.source
~cf.BoundsFromNodesArray.subarray_parameters
~cf.BoundsFromNodesArray.subarray_shapes
~cf.BoundsFromNodesArray.subarrays
~cf.BoundsFromNodesArray.to_dask_array
~cf.BoundsFromNodesArray.to_memory

.. rubric:: Attributes

.. autosummary::
:nosignatures:
:toctree: ../attribute/
:template: at

~cf.BoundsFromNodesArray.Units
~cf.BoundsFromNodesArray.array
~cf.BoundsFromNodesArray.compressed_array
~cf.BoundsFromNodesArray.dtype
~cf.BoundsFromNodesArray.ndim
~cf.BoundsFromNodesArray.shape
~cf.BoundsFromNodesArray.size


Loading
Loading