Skip to content

Commit

Permalink
Fix stock CDL headers for unlimited time dimension. (#4827)
Browse files Browse the repository at this point in the history
* Fix CDL headers for tests.stock.netcdf.

* Whats new entry.

* Improved unlimited dimension check in stock NetCDF generation.
  • Loading branch information
trexfeathers authored Jun 23, 2022
1 parent c5dd7da commit c2ff2ee
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/src/whatsnew/latest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@ This document explains the changes made to Iris for this release
bin in the system PATH.
(:pull:`4794`)

#. `@trexfeathers`_ and `@pp-mo`_ fixed the CDL headers for
:mod:`iris.tests.stock.netcdf` to allow generation of NetCDF-4 files with an
unlimited time dimension.
(:pull:`4827`)


.. comment
Whatsnew author names (@github name) in alphabetical order. Note that,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,8 @@ variables:
:name = "${DATASET_NAME}" ;
// original name = "lfric_ngvat_2D_1t_face_half_levels_main_conv_rain"
:Conventions = "UGRID" ;

// data
data:
time_instant = 0 ;
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,8 @@ variables:
:name = "${DATASET_NAME}" ;
// original name = "lfric_ngvat_3D_1t_full_level_face_grid_main_u3"
:Conventions = "UGRID" ;

// data
data:
time_instant = 0 ;
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,8 @@ variables:
:name = "${DATASET_NAME}" ;
// original name = "lfric_ngvat_3D_1t_half_level_face_grid_derived_theta_in_w3"
:Conventions = "UGRID" ;

// data
data:
time_instant = 0 ;
}
2 changes: 1 addition & 1 deletion lib/iris/tests/stock/netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _add_standard_data(nc_path, unlimited_dim_size=0):
ds = netCDF4.Dataset(nc_path, "r+")

unlimited_dim_names = [
dim for dim in ds.dimensions if ds.dimensions[dim].size == 0
dim for dim in ds.dimensions if ds.dimensions[dim].isunlimited()
]
# Data addition dependent on this assumption:
assert len(unlimited_dim_names) < 2
Expand Down

0 comments on commit c2ff2ee

Please sign in to comment.