climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From huiky...@apache.org
Subject [1/2] climate git commit: CLIMATE-714 - Updating the regridding routine
Date Thu, 10 Dec 2015 18:28:25 GMT
Repository: climate
Updated Branches:
  refs/heads/master bc6c08c08 -> 126b3b9a7


CLIMATE-714 - Updating the regridding routine

- ocw.dataset_processor._rcmes_spatial_regrid has been replaced by scipy.interpolate.griddata
to properly regrid datasets in curvilinear grid.


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

Branch: refs/heads/master
Commit: 643618631842e0c105308d3b2d1c8417e4fad735
Parents: bc6c08c
Author: huikyole <huikyole@argo.jpl.nasa.gov>
Authored: Thu Dec 10 06:06:49 2015 -0800
Committer: huikyole <huikyole@argo.jpl.nasa.gov>
Committed: Thu Dec 10 06:06:49 2015 -0800

----------------------------------------------------------------------
 examples/configuration_file_examples/run_RCMES.py | 2 ++
 ocw/dataset_processor.py                          | 8 +++-----
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/64361863/examples/configuration_file_examples/run_RCMES.py
----------------------------------------------------------------------
diff --git a/examples/configuration_file_examples/run_RCMES.py b/examples/configuration_file_examples/run_RCMES.py
index 99a06bb..fdf179b 100644
--- a/examples/configuration_file_examples/run_RCMES.py
+++ b/examples/configuration_file_examples/run_RCMES.py
@@ -145,8 +145,10 @@ for model_name in model_names:
 print 'Regridding datasets: ', config['regrid']
 if not config['regrid']['regrid_on_reference']:
     ref_dataset = dsp.spatial_regrid(ref_dataset, new_lat, new_lon)
+    print 'Reference dataset has been regridded'
 for idata,dataset in enumerate(model_datasets):
     model_datasets[idata] = dsp.spatial_regrid(dataset, new_lat, new_lon)
+    print model_names[idata]+' has been regridded'
 
 print 'Propagating missing data information'
 ref_dataset = dsp.mask_missing_data([ref_dataset]+model_datasets)[0]

http://git-wip-us.apache.org/repos/asf/climate/blob/64361863/ocw/dataset_processor.py
----------------------------------------------------------------------
diff --git a/ocw/dataset_processor.py b/ocw/dataset_processor.py
index ea08680..739ef5d 100755
--- a/ocw/dataset_processor.py
+++ b/ocw/dataset_processor.py
@@ -218,11 +218,9 @@ def spatial_regrid(target_dataset, new_latitudes, new_longitudes):
     
     # Call _rcmes_spatial_regrid on each time slice
     for i in range(len(target_dataset.times)):
-        new_values[i] = _rcmes_spatial_regrid(target_values[i],
-                                              lats,
-                                              lons,
-                                              new_lats,
-                                              new_lons)
+        print 'Regridding time = %d/%d' %(i+1,len(target_dataset.times))
+        new_values[i] = scipy.interpolate.griddata((lons.flatten(), lats.flatten()), target_values[i].flatten(),
+                                              (new_lons.flatten(), new_lats.flatten()), method='linear').reshape([new_lats.shape[0],new_lons.shape[1]])
     
     # TODO: 
     # This will call down to the _congrid() function and the lat and lon 


Mime
View raw message