Skip to content

Commit

Permalink
Merge pull request #181 from davidhassell/subsampled-docs
Browse files Browse the repository at this point in the history
Subsampled docs tidy
  • Loading branch information
davidhassell authored Mar 21, 2022
2 parents dc3e37f + 0c6f2d7 commit 1e1c74a
Show file tree
Hide file tree
Showing 27 changed files with 237 additions and 17 deletions.
10 changes: 10 additions & 0 deletions Changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
Version 1.9.1.0
---------------

**2022-??-??**

* Implement (bar writing to netCDF files) lossy compression by
coordinate subsampling (https://github.com/NCAS-CMS/cfdm/issues/167)

----

Version 1.9.0.3
---------------

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ The ``cfdm`` package can:
* create subspaces of field and domain constructs,
* incorporate, and create, metadata stored in external files, and
* read, write, and create data that have been compressed by convention
(i.e. ragged or gathered arrays), whilst presenting a view of the
data in its uncompressed form.
(i.e. ragged or gathered arrays, or coordinate arrays compressed by
subsampling), whilst presenting a view of the data in its
uncompressed form.

Command line utility
====================
Expand Down
4 changes: 2 additions & 2 deletions cfdm/data/abstract/compressedarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def compressed_dimensions(self):
return self._get_component("compressed_dimensions").copy()

def conformed_data(self):
"""The data as required by the decompression algorthm.
"""The data as required by the decompression algorithm.
.. versionadded:: (cfdm) 1.9.TODO.0
Expand Down Expand Up @@ -473,7 +473,7 @@ def subarrays(self, shapes=-1):
:Returns:
sequence of iterables
sequence of iterable
Each iterable iterates over a particular descriptor
from each subarray.
Expand Down
1 change: 1 addition & 0 deletions docs/source/class/cfdm.AuxiliaryCoordinate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ Miscellaneous
~cfdm.AuxiliaryCoordinate.equals
~cfdm.AuxiliaryCoordinate.uncompress
~cfdm.AuxiliaryCoordinate.get_filenames
~cfdm.AuxiliaryCoordinate.to_memory

NetCDF
------
Expand Down
1 change: 1 addition & 0 deletions docs/source/class/cfdm.Bounds.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Miscellaneous
~cfdm.Bounds.has_bounds
~cfdm.Bounds.uncompress
~cfdm.Bounds.get_filenames
~cfdm.Bounds.to_memory

NetCDF
------
Expand Down
1 change: 1 addition & 0 deletions docs/source/class/cfdm.CellMeasure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Miscellaneous
~cfdm.CellMeasure.has_bounds
~cfdm.CellMeasure.uncompress
~cfdm.CellMeasure.get_filenames
~cfdm.CellMeasure.to_memory

NetCDF
------
Expand Down
5 changes: 5 additions & 0 deletions docs/source/class/cfdm.CompressedArray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,14 @@ Compression
:toctree: ../method/
:template: method.rst

~cfdm.CompressedArray.compressed_dimensions
~cfdm.CompressedArray.get_compressed_axes
~cfdm.CompressedArray.get_compressed_dimension
~cfdm.CompressedArray.get_compression_type
~cfdm.CompressedArray.subarray_shapes
~cfdm.CompressedArray.subarrays
~cfdm.CompressedArray.get_Subarray
~cfdm.CompressedArray.conformed_data

Miscellaneous
-------------
Expand Down
1 change: 1 addition & 0 deletions docs/source/class/cfdm.Count.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Miscellaneous
~cfdm.Count.get_filenames
~cfdm.Count.has_bounds
~cfdm.Count.uncompress
~cfdm.Count.to_memory

NetCDF
------
Expand Down
9 changes: 9 additions & 0 deletions docs/source/class/cfdm.Data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,15 @@ Miscellaneous
~cfdm.Data.get_filenames
~cfdm.Data.source

.. rubric:: Attributes

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

~cfdm.Data.data

Performance
-----------

Expand Down
1 change: 1 addition & 0 deletions docs/source/class/cfdm.DimensionCoordinate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ Miscellaneous
~cfdm.DimensionCoordinate.equals
~cfdm.DimensionCoordinate.uncompress
~cfdm.DimensionCoordinate.get_filenames
~cfdm.DimensionCoordinate.to_memory

NetCDF
------
Expand Down
1 change: 1 addition & 0 deletions docs/source/class/cfdm.Domain.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ Miscellaneous
~cfdm.Domain.has_geometry
~cfdm.Domain.apply_masking
~cfdm.Domain.get_filenames
~cfdm.Domain.uncompress

NetCDF
------
Expand Down
1 change: 1 addition & 0 deletions docs/source/class/cfdm.DomainAncillary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ Miscellaneous
~cfdm.DomainAncillary.equals
~cfdm.DomainAncillary.uncompress
~cfdm.DomainAncillary.get_filenames
~cfdm.DomainAncillary.to_memory

NetCDF
------
Expand Down
1 change: 1 addition & 0 deletions docs/source/class/cfdm.Field.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ Miscellaneous
~cfdm.Field.has_geometry
~cfdm.Field.uncompress
~cfdm.Field.get_filenames
~cfdm.Field.to_memory

.. _Field-NetCDF:

Expand Down
1 change: 1 addition & 0 deletions docs/source/class/cfdm.FieldAncillary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Miscellaneous
~cfdm.FieldAncillary.has_bounds
~cfdm.FieldAncillary.uncompress
~cfdm.FieldAncillary.get_filenames
~cfdm.FieldAncillary.to_memory

NetCDF
------
Expand Down
5 changes: 5 additions & 0 deletions docs/source/class/cfdm.GatheredArray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Inspection
:toctree: ../method/
:template: method.rst

~cfdm.GatheredArray.compressed_dimensions
~cfdm.GatheredArray.get_compressed_axes
~cfdm.GatheredArray.get_compressed_dimension
~cfdm.GatheredArray.get_compression_type
Expand Down Expand Up @@ -53,6 +54,10 @@ Miscellaneous
~cfdm.GatheredArray.get_subspace
~cfdm.GatheredArray.source
~cfdm.GatheredArray.to_memory
~cfdm.GatheredArray.subarray_shapes
~cfdm.GatheredArray.subarrays
~cfdm.GatheredArray.get_Subarray
~cfdm.GatheredArray.conformed_data

Special
-------
Expand Down
1 change: 1 addition & 0 deletions docs/source/class/cfdm.Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Miscellaneous
~cfdm.Index.get_filenames
~cfdm.Index.has_bounds
~cfdm.Index.uncompress
~cfdm.Index.to_memory

NetCDF
------
Expand Down
1 change: 1 addition & 0 deletions docs/source/class/cfdm.InteriorRing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Miscellaneous
~cfdm.InteriorRing.has_bounds
~cfdm.InteriorRing.uncompress
~cfdm.InteriorRing.get_filenames
~cfdm.InteriorRing.to_memory

NetCDF
------
Expand Down
1 change: 1 addition & 0 deletions docs/source/class/cfdm.List.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Miscellaneous
~cfdm.List.get_filenames
~cfdm.List.has_bounds
~cfdm.List.uncompress
~cfdm.List.to_memory

NetCDF
------
Expand Down
1 change: 1 addition & 0 deletions docs/source/class/cfdm.NetCDFArray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ File
~cfdm.NetCDFArray.get_filename
~cfdm.NetCDFArray.get_group
~cfdm.NetCDFArray.get_mask
~cfdm.NetCDFArray.file_address

Miscellaneous
-------------
Expand Down
8 changes: 7 additions & 1 deletion docs/source/class/cfdm.RaggedContiguousArray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ Inspection
:toctree: ../method/
:template: method.rst

~cfdm.RaggedContiguousArray.get_compressed_axes
~cfdm.RaggedContiguousArray.compressed_dimensions
~cfdm.RaggedContiguousArray.get_compressed_axes
~cfdm.RaggedContiguousArray.get_compressed_dimension
~cfdm.RaggedContiguousArray.get_compression_type
~cfdm.RaggedContiguousArray.get_count
Expand Down Expand Up @@ -53,6 +54,11 @@ Miscellaneous
~cfdm.RaggedContiguousArray.get_subspace
~cfdm.RaggedContiguousArray.source
~cfdm.RaggedContiguousArray.to_memory
~cfdm.RaggedContiguousArray.subarray_shapes
~cfdm.RaggedContiguousArray.subarrays
~cfdm.RaggedContiguousArray.get_Subarray
~cfdm.RaggedContiguousArray.conformed_data
~cfdm.RaggedContiguousArray.get_index

Special
-------
Expand Down
6 changes: 6 additions & 0 deletions docs/source/class/cfdm.RaggedIndexedArray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Inspection
:toctree: ../method/
:template: method.rst

~cfdm.RaggedIndexedArray.compressed_dimensions
~cfdm.RaggedIndexedArray.get_compressed_axes
~cfdm.RaggedIndexedArray.get_compressed_dimension
~cfdm.RaggedIndexedArray.get_compression_type
Expand Down Expand Up @@ -53,6 +54,11 @@ Miscellaneous
~cfdm.RaggedIndexedArray.get_subspace
~cfdm.RaggedIndexedArray.source
~cfdm.RaggedIndexedArray.to_memory
~cfdm.RaggedIndexedArray.subarray_shapes
~cfdm.RaggedIndexedArray.subarrays
~cfdm.RaggedIndexedArray.get_Subarray
~cfdm.RaggedIndexedArray.conformed_data
~cfdm.RaggedIndexedArray.get_count

Special
-------
Expand Down
5 changes: 5 additions & 0 deletions docs/source/class/cfdm.RaggedIndexedContiguousArray.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Inspection
:toctree: ../method/
:template: method.rst

~cfdm.RaggedIndexedContiguousArray.compressed_dimensions
~cfdm.RaggedIndexedContiguousArray.get_compressed_axes
~cfdm.RaggedIndexedContiguousArray.get_compressed_dimension
~cfdm.RaggedIndexedContiguousArray.get_compression_type
Expand Down Expand Up @@ -54,6 +55,10 @@ Miscellaneous
~cfdm.RaggedIndexedContiguousArray.get_subspace
~cfdm.RaggedIndexedContiguousArray.source
~cfdm.RaggedIndexedContiguousArray.to_memory
~cfdm.RaggedIndexedContiguousArray.subarray_shapes
~cfdm.RaggedIndexedContiguousArray.subarrays
~cfdm.RaggedIndexedContiguousArray.get_Subarray
~cfdm.RaggedIndexedContiguousArray.conformed_data

Special
-------
Expand Down
5 changes: 3 additions & 2 deletions docs/source/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ The cfdm package can
* incorporate, and create, metadata stored in external files, and

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

Note that the cfdm package enables the representation and creation of
CF field constructs, but it is largely :ref:`up to the user to use
Expand Down
Binary file added docs/source/sample_files/subsampled.nc
Binary file not shown.
2 changes: 2 additions & 0 deletions docs/source/spelling_false_positives.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ Signell
situ
spatiotemporal
str
subarray
subarrays
subceed
subclassed
subclassing
Expand Down
22 changes: 19 additions & 3 deletions docs/source/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@
# uncompressed shape
array = cfdm.RaggedContiguousArray(
compressed_array=ragged_array,
shape=(2, 4), size=8, ndim=2,
shape=(2, 4),
count_variable=count_variable)

# Create the field construct with the domain axes and the ragged
Expand Down Expand Up @@ -775,8 +775,8 @@
# shape
array = cfdm.GatheredArray(
compressed_array=gathered_array,
compressed_dimension=1,
shape=(2, 3, 2), size=12, ndim=3,
compressed_dimensions={1: (1, 2)},
shape=(2, 3, 2),
list_variable=list_variable)

# Create the field construct with the domain axes and the gathered
Expand All @@ -801,3 +801,19 @@
list_variable
print(list_variable.data.array)
cfdm.write(P, 'P_gathered.nc')
f = cfdm.read('subsampled.nc')[0]
print(f)
lon = f.construct('longitude')
lon
lon.data.source()
print(lon.data.array)
lon.data.source().source()
print(lon.data.source().source().array)
print(lon.data.array)
g = f[0, 6, :]
print(g)
print(g.construct('longitude').data.array)
lon = f.construct('longitude')
d = lon.data.source()
d.get_tie_point_indices()
d.get_computational_precision()
Loading

0 comments on commit 1e1c74a

Please sign in to comment.