climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From huiky...@apache.org
Subject svn commit: r1479720 - in /incubator/climate/trunk/rcmet/src/main/python/rcmes: resources/cordexAF.cfg toolkit/do_data_prep.py
Date Mon, 06 May 2013 23:24:38 GMT
Author: huikyole
Date: Mon May  6 23:24:37 2013
New Revision: 1479720

URL: http://svn.apache.org/r1479720
Log:
Minor fixes for prep_data. mdlName now includes only model names not the model file names

Modified:
    incubator/climate/trunk/rcmet/src/main/python/rcmes/resources/cordexAF.cfg
    incubator/climate/trunk/rcmet/src/main/python/rcmes/toolkit/do_data_prep.py

Modified: incubator/climate/trunk/rcmet/src/main/python/rcmes/resources/cordexAF.cfg
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/python/rcmes/resources/cordexAF.cfg?rev=1479720&r1=1479719&r2=1479720&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/python/rcmes/resources/cordexAF.cfg (original)
+++ incubator/climate/trunk/rcmet/src/main/python/rcmes/resources/cordexAF.cfg Mon May  6
23:24:37 2013
@@ -1,6 +1,6 @@
 [SETTINGS]
-workDir=../rcmes/cases/cordex-af/wrk2
-cacheDir=../rcmes/cases/cordex-af/cache
+workDir=/home/huikyole/work/RCMES/cases/cordex-af
+cacheDir=/nas/share4-cf/huikyole/RCMES_cache
 # Choices: full, annual, monthly, daily
 temporalGrid=monthly
 # Choices, obs, model, user

Modified: incubator/climate/trunk/rcmet/src/main/python/rcmes/toolkit/do_data_prep.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/python/rcmes/toolkit/do_data_prep.py?rev=1479720&r1=1479719&r2=1479720&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/python/rcmes/toolkit/do_data_prep.py (original)
+++ incubator/climate/trunk/rcmet/src/main/python/rcmes/toolkit/do_data_prep.py Mon May  6
23:24:37 2013
@@ -3,7 +3,7 @@
 
 import numpy as np
 import numpy.ma as ma
-import sys
+import sys, os
 
 import Nio
 
@@ -46,7 +46,7 @@ def prep_data(settings, obsDatasetList, 
     obsParameterId = [str(x['parameter_id']) for x in obsDatasetList]
     obsTimestep = [str(x['timestep']) for x in obsDatasetList]
     mdlList = [model.filename for model in modelList]
-    
+
     # Since all of the model objects in the modelList have the same Varnames and Precip Flag,
I am going to merely 
     # pull this from modelList[0] for now
     modelVarName = modelList[0].varName
@@ -255,10 +255,21 @@ def prep_data(settings, obsDatasetList, 
     ##       the total number of months, respectively, in later multi-model calculations.
 
     typeF = 'nc'
-    #mdlName = []
     regridMdlData = []
+    # extract the model names and store them in the list 'mdlList'
+    mdlName = []
+    mdlListReversed=[]
+    if len(mdlList) >1:
+       for element in mdlList:
+           mdlListReversed.append(element[::-1])
+       prefix=os.path.commonprefix(mdlList)
+       postfix=os.path.commonprefix(mdlListReversed)[::-1]
+       for element in mdlList:
+           mdlName.append(element.replace(prefix,'').replace(postfix,''))
+    else:
+        mdlName.append('model') 
+
     
-    # extract the model names and store them in the list 'mdlName'
     for n in np.arange(numMDLs):
         # read model grid info, then model data
         ifile = mdlList[n]
@@ -360,4 +371,4 @@ def prep_data(settings, obsDatasetList, 
 
     # Processing complete
     print 'data_prep is completed: both obs and mdl data are re-gridded to a common analysis
grid'
-    return numOBSs, numMDLs, nT, ngrdY, ngrdX, Times, lons, lats, obsData, modelData, obsList,
mdlList
+    return numOBSs, numMDLs, nT, ngrdY, ngrdX, Times, lons, lats, obsData, modelData, obsList,
mdlName



Mime
View raw message