Commit 5f110880 authored by Javier Vegas-Regidor's avatar Javier Vegas-Regidor
Browse files

Fixed bug on datamanager

parent 135f1fc1
......@@ -766,12 +766,15 @@ class DataManager(object):
:return: path to the copy created on the scratch folder
:rtype: str
"""
original_var = var
cmor_var = Variable.get_variable(var)
if box:
var += box.get_lon_str() + box.get_lat_str() + box.get_depth_str()
if rename_var:
Utils.rename_variable(filetosend, rename_var, var)
elif original_var != var:
Utils.rename_variable(filetosend, original_var, var)
if not frequency:
frequency = self.frequency
......@@ -853,13 +856,13 @@ class DataManager(object):
Utils.move_file(temp, filetosend)
Utils.nco.ncks(input=filetosend, output=filetosend, options='-O --fix_rec_dmn region')
if cmor_var:
handler = Utils.openCdf(filetosend)
var_handler = handler.variables[var]
var_handler.standard_name = cmor_var.standard_name
var_handler.long_name = cmor_var.long_name
var_handler.short_name = cmor_var.short_name
var_handler.missingValue = 1.e20
if cmor_var.units and cmor_var.units != var_handler.units:
factor, offset = UnitConversion.get_conversion_factor_offset(var_handler.units, cmor_var.units)
if factor is not None:
......
......@@ -86,6 +86,7 @@ class HeatContentLayer(Diagnostic):
depth = handler.variables['gdepw_0'][:]
else:
raise Exception('gdepw variable can not be found')
while len(depth.shape) < 4:
depth = np.expand_dims(depth, -1)
handler.close()
......@@ -166,10 +167,8 @@ class HeatContentLayer(Diagnostic):
nco.ncks(input=thetao_file, output=results, options='-O -v lon,lat,time')
Utils.rename_variables(results, {'x': 'i', 'y': 'j'}, False, True)
handler_results = Utils.openCdf(results)
handler_results.createVariable('ohc', float, ('time', 'j', 'i'))
handler_results.close()
handler_results = Utils.openCdf(results)
handler_results.createVariable('ohc', float, ('time', 'j', 'i'), fill_value=1.e20)
handler_results.sync()
handler_results.variables['ohc'][:] = heatc_sl
handler_results.close()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment