Skip to content

Commit d4d0514

Browse files
pp-motrexfeathers
andauthored
Cubeprinter adopt (#4206)
* Adopt new-style Cube printout. * Fix some import orderings. * Replace old cube summary code with new CubeSummary-based implementation. * Removed additional colons. * Slightly altered behaviour + specific test fixes. * Test result changes. * Code standard fixes. * More test fixes. * Doctest fixes. * Fix doctest output for python 3.8. * Fix merged docs test. * Make cube-summary list attributes last. * Fix affected tests. * Another test fix. * Reformat TODO string to aid IDE recognition. * CubePrinter tab size constants. * CubePrinter don't bother assigning cube_summary on ingestion. * cube_printout docstring fixes. * Cube summary align cell methods with other tabbed content. * Remove CubePrinter TODO. * Remove CubeSummary TODO. * Remove commented cube summary code. * Cube summary what's new entries. Co-authored-by: Martin Yeo <[email protected]>
1 parent 4abaa8f commit d4d0514

Some content is hidden

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

44 files changed

+1956
-1290
lines changed

docs/src/further_topics/lenient_maths.rst

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -68,26 +68,26 @@ represents the output of an low-resolution global atmospheric ``experiment``,
6868
.. doctest:: lenient-example
6969

7070
>>> print(experiment)
71-
air_potential_temperature / (K) (model_level_number: 15; grid_latitude: 100; grid_longitude: 100)
72-
Dimension coordinates:
73-
model_level_number x - -
74-
grid_latitude - x -
75-
grid_longitude - - x
76-
Auxiliary coordinates:
77-
atmosphere_hybrid_height_coordinate x - -
78-
sigma x - -
79-
surface_altitude - x x
80-
Derived coordinates:
81-
altitude x x x
82-
Scalar coordinates:
83-
forecast_period: 0.0 hours
84-
forecast_reference_time: 2009-09-09 17:10:00
85-
time: 2009-09-09 17:10:00
86-
Attributes:
87-
Conventions: CF-1.5
88-
STASH: m01s00i004
89-
experiment-id: RT3 50
90-
source: Data from Met Office Unified Model 7.04
71+
air_potential_temperature / (K) (model_level_number: 15; grid_latitude: 100; grid_longitude: 100)
72+
Dimension coordinates:
73+
model_level_number x - -
74+
grid_latitude - x -
75+
grid_longitude - - x
76+
Auxiliary coordinates:
77+
atmosphere_hybrid_height_coordinate x - -
78+
sigma x - -
79+
surface_altitude - x x
80+
Derived coordinates:
81+
altitude x x x
82+
Scalar coordinates:
83+
forecast_period 0.0 hours
84+
forecast_reference_time 2009-09-09 17:10:00
85+
time 2009-09-09 17:10:00
86+
Attributes:
87+
Conventions CF-1.5
88+
STASH m01s00i004
89+
experiment-id RT3 50
90+
source Data from Met Office Unified Model 7.04
9191

9292
Consider also the following :class:`~iris.cube.Cube`, which has the same global
9393
spatial extent, and acts as a ``control``,
@@ -96,41 +96,41 @@ spatial extent, and acts as a ``control``,
9696

9797
>>> print(control)
9898
air_potential_temperature / (K) (grid_latitude: 100; grid_longitude: 100)
99-
Dimension coordinates:
100-
grid_latitude x -
101-
grid_longitude - x
102-
Scalar coordinates:
103-
model_level_number: 1
104-
time: 2009-09-09 17:10:00
105-
Attributes:
106-
Conventions: CF-1.7
107-
STASH: m01s00i004
108-
source: Data from Met Office Unified Model 7.04
99+
Dimension coordinates:
100+
grid_latitude x -
101+
grid_longitude - x
102+
Scalar coordinates:
103+
model_level_number 1
104+
time 2009-09-09 17:10:00
105+
Attributes:
106+
Conventions CF-1.7
107+
STASH m01s00i004
108+
source Data from Met Office Unified Model 7.04
109109

110110
Now let's subtract these cubes in order to calculate a simple ``difference``,
111111

112112
.. doctest:: lenient-example
113113

114114
>>> difference = experiment - control
115115
>>> print(difference)
116-
unknown / (K) (model_level_number: 15; grid_latitude: 100; grid_longitude: 100)
117-
Dimension coordinates:
118-
model_level_number x - -
119-
grid_latitude - x -
120-
grid_longitude - - x
121-
Auxiliary coordinates:
122-
atmosphere_hybrid_height_coordinate x - -
123-
sigma x - -
124-
surface_altitude - x x
125-
Derived coordinates:
126-
altitude x x x
127-
Scalar coordinates:
128-
forecast_period: 0.0 hours
129-
forecast_reference_time: 2009-09-09 17:10:00
130-
time: 2009-09-09 17:10:00
131-
Attributes:
132-
experiment-id: RT3 50
133-
source: Data from Met Office Unified Model 7.04
116+
unknown / (K) (model_level_number: 15; grid_latitude: 100; grid_longitude: 100)
117+
Dimension coordinates:
118+
model_level_number x - -
119+
grid_latitude - x -
120+
grid_longitude - - x
121+
Auxiliary coordinates:
122+
atmosphere_hybrid_height_coordinate x - -
123+
sigma x - -
124+
surface_altitude - x x
125+
Derived coordinates:
126+
altitude x x x
127+
Scalar coordinates:
128+
forecast_period 0.0 hours
129+
forecast_reference_time 2009-09-09 17:10:00
130+
time 2009-09-09 17:10:00
131+
Attributes:
132+
experiment-id RT3 50
133+
source Data from Met Office Unified Model 7.04
134134

135135
Note that, cube maths automatically takes care of broadcasting the
136136
dimensionality of the ``control`` up to that of the ``experiment``, in order to
@@ -204,21 +204,21 @@ time perform **strict** cube maths instead,
204204
... difference = experiment - control
205205
...
206206
>>> print(difference)
207-
unknown / (K) (model_level_number: 15; grid_latitude: 100; grid_longitude: 100)
208-
Dimension coordinates:
209-
model_level_number x - -
210-
grid_latitude - x -
211-
grid_longitude - - x
212-
Auxiliary coordinates:
213-
atmosphere_hybrid_height_coordinate x - -
214-
sigma x - -
215-
surface_altitude - x x
216-
Derived coordinates:
217-
altitude x x x
218-
Scalar coordinates:
219-
time: 2009-09-09 17:10:00
220-
Attributes:
221-
source: Data from Met Office Unified Model 7.04
207+
unknown / (K) (model_level_number: 15; grid_latitude: 100; grid_longitude: 100)
208+
Dimension coordinates:
209+
model_level_number x - -
210+
grid_latitude - x -
211+
grid_longitude - - x
212+
Auxiliary coordinates:
213+
atmosphere_hybrid_height_coordinate x - -
214+
sigma x - -
215+
surface_altitude - x x
216+
Derived coordinates:
217+
altitude x x x
218+
Scalar coordinates:
219+
time 2009-09-09 17:10:00
220+
Attributes:
221+
source Data from Met Office Unified Model 7.04
222222

223223
Although the numerical result of this strict cube maths operation is identical,
224224
it is not as rich in metadata as the :ref:`lenient alternative <lenient example>`.

docs/src/further_topics/metadata.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,22 @@ For example, given the following :class:`~iris.cube.Cube`,
108108

109109
>>> print(cube)
110110
air_temperature / (K) (time: 240; latitude: 37; longitude: 49)
111-
Dimension coordinates:
112-
time x - -
113-
latitude - x -
114-
longitude - - x
115-
Auxiliary coordinates:
116-
forecast_period x - -
117-
Scalar coordinates:
118-
forecast_reference_time: 1859-09-01 06:00:00
119-
height: 1.5 m
120-
Attributes:
121-
Conventions: CF-1.5
122-
Model scenario: A1B
123-
STASH: m01s03i236
124-
source: Data from Met Office Unified Model 6.05
125-
Cell methods:
126-
mean: time (6 hour)
111+
Dimension coordinates:
112+
time x - -
113+
latitude - x -
114+
longitude - - x
115+
Auxiliary coordinates:
116+
forecast_period x - -
117+
Scalar coordinates:
118+
forecast_reference_time 1859-09-01 06:00:00
119+
height 1.5 m
120+
Cell methods:
121+
mean time (6 hour)
122+
Attributes:
123+
Conventions CF-1.5
124+
Model scenario A1B
125+
STASH m01s03i236
126+
source Data from Met Office Unified Model 6.05
127127

128128
We can easily get all of the associated metadata of the :class:`~iris.cube.Cube`
129129
using the ``metadata`` property:

docs/src/userguide/cube_maths.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ but with the data representing their difference:
5656

5757
>>> print(t_last - t_first)
5858
unknown / (K) (latitude: 37; longitude: 49)
59-
Dimension coordinates:
60-
latitude x -
61-
longitude - x
62-
Scalar coordinates:
63-
forecast_reference_time: 1859-09-01 06:00:00
64-
height: 1.5 m
65-
Attributes:
66-
Conventions: CF-1.5
67-
Model scenario: E1
68-
source: Data from Met Office Unified Model 6.05
59+
Dimension coordinates:
60+
latitude x -
61+
longitude - x
62+
Scalar coordinates:
63+
forecast_reference_time 1859-09-01 06:00:00
64+
height 1.5 m
65+
Attributes:
66+
Conventions CF-1.5
67+
Model scenario E1
68+
source Data from Met Office Unified Model 6.05
6969

7070

7171
.. note::

0 commit comments

Comments
 (0)