climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From huiky...@apache.org
Subject [1/3] climate git commit: CLIMATE-962 - Handling of NAN values while loading datasets local.load_file has been updated to mask NaN values
Date Sun, 25 Nov 2018 03:05:47 GMT
Repository: climate
Updated Branches:
  refs/heads/master cf3ef6015 -> 27db6a678


CLIMATE-962 - Handling of NAN values while loading datasets
local.load_file has been updated to mask NaN values


Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/8e74c7f8
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/8e74c7f8
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/8e74c7f8

Branch: refs/heads/master
Commit: 8e74c7f888d6855f6357cac3f028aed85fbacf77
Parents: cf3ef60
Author: huikyole <huikyo.lee@jpl.nasa.gov>
Authored: Sat Nov 24 18:00:03 2018 -0800
Committer: huikyole <huikyo.lee@jpl.nasa.gov>
Committed: Sat Nov 24 18:00:03 2018 -0800

----------------------------------------------------------------------
 ocw/data_source/local.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/8e74c7f8/ocw/data_source/local.py
----------------------------------------------------------------------
diff --git a/ocw/data_source/local.py b/ocw/data_source/local.py
index 45a57f9..5056640 100644
--- a/ocw/data_source/local.py
+++ b/ocw/data_source/local.py
@@ -260,6 +260,7 @@ def load_file(file_path,
     times = utils.decode_time_values(netcdf, time_name)
     times = numpy.array(times)
     values = ma.array(netcdf.variables[variable_name][:])
+    values = ma.array(values, mask=np.isnan(values))
     if not variable_unit:
         if hasattr(netcdf.variables[variable_name], 'units'):
             variable_unit = netcdf.variables[variable_name].units
@@ -536,7 +537,7 @@ def load_dataset_from_multiple_netcdf_files(variable_name, variable_unit=None,
         if ifile == 0:
             data_values = values0
         else:
-            data_values = numpy.concatenate((data_values, values0))
+            data_values = ma.concatenate((data_values, values0))
     times = numpy.array(times)
     variable_unit = dataset0.units if not variable_unit else variable_unit
     return Dataset(lats, lons, times, data_values,


Mime
View raw message