diff --git a/VERSION b/VERSION index 187366829bf28bb4094ebffa20e3e1959623e9de..fb62f4077b27f0b2fe8a57be9d9b9baa798a8914 100644 --- a/VERSION +++ b/VERSION @@ -1,2 +1,2 @@ -3.0.0b40 +3.0.0b41 diff --git a/doc/source/conf.py b/doc/source/conf.py index 33a724e873d0e579779fcefcf15c954f643fe18f..89ede55ddaa466d150cd53612fd42177763eca53 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -64,7 +64,7 @@ copyright = u'2016, BSC-CNS Earth Sciences Department' # The short X.Y version. version = '3.0b' # The full version, including alpha/beta/rc tags. -release = '3.0.0b40' +release = '3.0.0b41' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/earthdiagnostics/EarthDiagnostics.pdf b/earthdiagnostics/EarthDiagnostics.pdf index cfc8af858302bbaee43ef698e7be55de1fca2018..302176c41181b9907265f0f07717fd58f9b89163 100644 Binary files a/earthdiagnostics/EarthDiagnostics.pdf and b/earthdiagnostics/EarthDiagnostics.pdf differ diff --git a/earthdiagnostics/cmor_tables/default.csv b/earthdiagnostics/cmor_tables/default.csv index 811422d90c4e40f3db21315432063028d98ec89c..0b3b4ce1c8adb246f74524cea1cb0eaa28fac20c 100644 --- a/earthdiagnostics/cmor_tables/default.csv +++ b/earthdiagnostics/cmor_tables/default.csv @@ -338,3 +338,6 @@ mud,mud,realized_growth_rate_for_diatomes,Realized growth rate for diatomes,ocnB ppnewn,ppnewn,new_primary_production_of_nanophyto,New Primary production of nanophyto,ocnBgchem,,,,,, ppnewd,ppnewd,new_primary_production_of_diatoms,New Primary production of diatoms,ocnBgchem,,,,,, dic,dic,disolved_inorganic_carbon,Disolved Inorganic Carbon,ocnBgchem,,,,,, +zqla,hflso,surface_downward_latent_heat_flux,Surface Downward Latent Heat Flux,ocean,,W m-2,,,, +zqsb,hfsso,surface_downward_sensible_heat_flux,Surface Downward Sensible Heat Flux,ocean,,W m-2,,,, +zqlw,rlntds,surface_net_downward_longwave_flux,Surface Net Downward Longwave Radiation,ocean,,W m-2,,,, diff --git a/earthdiagnostics/cmorizer.py b/earthdiagnostics/cmorizer.py index d704f87f52ad5dad1fc3aa065d157d4caff710bf..a15dabd089db6be59e72bff3115c9633a45b1135 100644 --- a/earthdiagnostics/cmorizer.py +++ b/earthdiagnostics/cmorizer.py @@ -397,7 +397,11 @@ class Cmorizer(object): self.data_manager.send_file(temp, var_cmor.domain, var_cmor.short_name, self.startdate, self.member, frequency=frequency, rename_var=variable, date_str=date_str, region=region, move_old=True, grid=alias.grid, cmorized=True) - Log.info('Variable {0.domain}:{0.short_name} processed', var_cmor) + if region: + region_str = ' (Region {})'.format(region) + else: + region_str = '' + Log.info('Variable {0.domain}:{0.short_name} processed{1}', var_cmor, region_str) def get_date_str(self, file_path): file_parts = os.path.basename(file_path).split('_') diff --git a/earthdiagnostics/datamanager.py b/earthdiagnostics/datamanager.py index 9e4c7a369053812f086c63ceba58c5ce1579b9f3..1740bb770b2b4a69a7f7195676692fe170edf58b 100644 --- a/earthdiagnostics/datamanager.py +++ b/earthdiagnostics/datamanager.py @@ -391,6 +391,8 @@ class NetCDFFile(object): def _fix_units(self, var_handler): if 'units' not in var_handler.ncattrs(): return + if var_handler.units == '-': + var_handler.units = '1.0' if var_handler.units == 'PSU': var_handler.units = 'psu' if var_handler.units == 'C' and self.cmor_var.units == 'K': diff --git a/earthdiagnostics/frequency.py b/earthdiagnostics/frequency.py index ff8b7e21e0e8bfbd7b24c54f19577eb9d33a46b3..1d278fe5c9dfde9cd0dd5d23daf7d0f3e16c3ef0 100644 --- a/earthdiagnostics/frequency.py +++ b/earthdiagnostics/frequency.py @@ -10,6 +10,8 @@ class Frequency(object): 'y': 'year', 'yr': 'year', 'year': 'year', 'yearly': 'year', 'm': 'mon', '1m': 'mon', 'mon': 'mon', 'monthly': 'mon', 'd': 'day', '1d': 'day', 'daily': 'day', 'day': 'day', + '15': '15hr', '15h': '15hr', '15hr': '15hr', '15_hourly': '15hr', '15hourly': '15hr', + '15 hourly': '15hr', '6': '6hr', '6h': '6hr', '6hr': '6hr', '6_hourly': '6hr', '6hourly': '6hr', '6 hourly': '6hr', '3': '3hr', '3h': '3hr', '3hr': '3hr', '3_hourly': '3hr', '3hourly': '3hr', '3 hourly': '3hr', '1': '1hr', 'hr': '1hr', '1h': '1hr', 'hourly': '1hr', '1hr': '1hr', '1 hourly': '1hr', diff --git a/earthdiagnostics/general/scale.py b/earthdiagnostics/general/scale.py index 1605df2ef6bd810ef3608363bf9a373b75a36a99..83ec9056d75293a9d3c4fe917732f7679c48931a 100644 --- a/earthdiagnostics/general/scale.py +++ b/earthdiagnostics/general/scale.py @@ -103,9 +103,9 @@ class Scale(Diagnostic): grid=self.grid) def _check_limits(self): - if not math.isnan(self.min_limit) and (self.original_values < self.min_limit).any(): + if not math.isnan(self.min_limit) and (self.original_values.min() < self.min_limit): return False - if not math.isnan(self.max_limit) and (self.original_values > self.max_limit).any(): + if not math.isnan(self.max_limit) and (self.original_values.max() > self.max_limit): return False return True diff --git a/earthdiagnostics/utils.py b/earthdiagnostics/utils.py index 67697b06007c8a45b328a9206cfdc70403debd18..dc0ce9843557a73c8921351c09dc46e99bf41935 100644 --- a/earthdiagnostics/utils.py +++ b/earthdiagnostics/utils.py @@ -14,6 +14,19 @@ from cdo import Cdo, CDOException from nco import Nco from earthdiagnostics.constants import Basins +from contextlib import contextmanager +import sys + + +@contextmanager +def suppress_stdout(): + with open(os.devnull, "w") as devnull: + old_stdout = sys.stdout + sys.stdout = devnull + try: + yield + finally: + sys.stdout = old_stdout class Utils(object): @@ -131,19 +144,20 @@ class Utils(object): error = True if error: - Log.info('First attemp to rename failed. Using secondary rename method for netCDF') + Log.debug('First attemp to rename failed. Using secondary rename method for netCDF') Utils._rename_vars_by_creating_new_file(dic_names, filepath, temp) - Log.info('Rename done') + Log.debug('Rename done') Utils.move_file(temp, filepath) @staticmethod def check_netcdf_file(filepath): - try: - Utils.cdo.showvar(input=filepath) - except CDOException: - return False - return True + with suppress_stdout(): + try: + Utils.cdo.showvar(input=filepath) + except CDOException: + return False + return True @staticmethod def get_file_variables(filename): diff --git a/earthdiagnostics/variable_alias/default.csv b/earthdiagnostics/variable_alias/default.csv index 993ca7b55e0a042ffc144871681902e50f22fb72..de9ec1510a0349a90f96e58ca4a91f54dd612d0e 100644 --- a/earthdiagnostics/variable_alias/default.csv +++ b/earthdiagnostics/variable_alias/default.csv @@ -41,7 +41,9 @@ sophtadv,hfbasinadv,, sophteiv,hfbasinba,, qt_oce:sohefldo:qt,hfds,, slhf,hfls,, -sshf,hfss,, +zqla,hflso,, +zqsb,hfsso,, +zqlw,rlntds,, sophtove,htovovrt,, q,hus,, soicealb,ialb,,