Skip to content

Commit

Permalink
Catch issues setting the var_name attribute in case e.g. the name isn…
Browse files Browse the repository at this point in the history
…'t CF-compliant
  • Loading branch information
duncanwp committed Feb 6, 2017
1 parent 55be9d9 commit a801cf6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
ungridded, but not a mix. For ungridded data lists it is assumed that all objects share the same coordinates.
"""
__author__ = "David Michel, Daniel Wallis, Duncan Watson-Parris, Richard Wilkinson, Ian Bush, Matt Kendall, John Holt"
__version__ = "1.5.2"
__status__ = "Stable"
__version__ = "1.5.3"
__status__ = "Dev"
__website__ = "http://www.cistools.net/"

__all__ = ['read_data', 'read_data_list', 'get_variables']
Expand Down
11 changes: 9 additions & 2 deletions cis/data_io/products/HadGEM.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from cis.data_io.products import NetCDF_Gridded
import logging


class HadGEM_CONVSH(NetCDF_Gridded):
Expand Down Expand Up @@ -104,11 +105,17 @@ def load_multiple_files_callback(cube, field, filename):
# This method sets the var_name (used for outputting the cube to NetCDF) to the cube name. This can be quite
# for some HadGEM variables but most commands allow the user to override this field on output.
var_name = cube.name()
cube.var_name = var_name
try:
cube.var_name = var_name
except ValueError as e:
logging.info("Unable to set var_name due to error: {}".format(e))

@staticmethod
def load_single_file_callback(cube, field, filename):
# This method sets the var_name (used for outputting the cube to NetCDF) to the cube name. This can be quite
# for some HadGEM variables but most commands allow the user to override this field on output.
var_name = cube.name()
cube.var_name = var_name
try:
cube.var_name = var_name
except ValueError as e:
logging.info("Unable to set var_name due to error: {}".format(e))
4 changes: 4 additions & 0 deletions doc/whats_new_1.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ CIS 1.5.2 fixes
* Minor fix for log scale color bars
* Minor fix for parsing the command aliases
* Minor fix for creating data lists from iterators

CIS 1.5.3 fixes
===============
* Minor fix when reading variables from PP files with spaces in the name

0 comments on commit a801cf6

Please sign in to comment.