Пример #1
0
    def compute(self):
        
        
        
        region = self.getInputFromPort("Region")
        dataset = self.getInputFromPort("DataSet")
        curdir = self.getInputFromPort("Directory")
        self.setResult("Directory", curdir)
        format_file = self.getInputFromPort("Format File")
        #start = self.getInputFromPort("Start Time")
        #end = self.getInputFromPort("End Time")
        
        
        self.setResult("Region", region)
        #Ex: SBDDS
        self.setResult("Format File", format_file)
        
        directories = [region, format_file, dataset]
        os.chdir(curdir.name)
        
        for dct in directories:
            file_loc = os.getcwd()+'\\'+dct
            if not os.path.exists(file_loc):
                os.mkdir(file_loc)
            os.chdir(file_loc)
        
        
#         if format_file == 'BCCA_CC':
#             mows_pyGDP_BCCA_CC.main_func(curdir.name, dt, region)
#             #Dataset ex: GENMON
#             self.setResult("DataSet", dt)
#             #Datatype ex: RT, TA
#             self.setResult("DataType", mows_pyGDP_BCCA_CC.vt_datatype)
#             self.setResult("nhru", mows_pyGDP_BCCA_CC.nhru)
#             #Timestep ex: Daily
#             self.setResult("Timestep", mows_pyGDP_BCCA_CC.length)
        def list_define():
            vt_list = []
            vt_list.append(region)
            vt_list.append(dataset)
            vt_list.append(format_file)
            vt_list.append(mows_pyGDP_SBDDS.vt_datatype)
            vt_list.append(mows_pyGDP_SBDDS.nhru)
            vt_list.append(mows_pyGDP_SBDDS.length)
            vt_list.append(mows_pyGDP_SBDDS.url)
            return vt_list
           
        if format_file == 'SBDDS':
            mows_pyGDP_SBDDS.main_func(os.getcwd(), dataset, region)
            #Dataset ex: GENMON
            #self.setResult("DataSet", dataset)
            #Datatype ex: RT, TA
            #self.setResult("DataType", mows_pyGDP_SBDDS.vt_datatype)
            #self.setResult("nhru", mows_pyGDP_SBDDS.nhru)
            #Timestep ex: Daily
            #self.setResult("Timestep", mows_pyGDP_SBDDS.length)
            #self.setResult("WFS_URL", mows_pyGDP_SBDDS.url)
            csvParse.main_func(region, dataset, mows_pyGDP_SBDDS.vt_datatype, format_file, os.getcwd())
            self.setResult("pyGDP List", list_define())
Пример #2
0
import csvParse, csv, os

os.chdir('C:\\Users\\reimandy\\Documents\\pyGDP')


csvParse.main_func(csv.reader(open('R06_NOAA NCEP.csv', 'rb')), ['RT', 'TA'])
csvParse.main_func(csv.reader(open('R06_GFDL CM 2.0.csv', 'rb')), ['RT', 'TA'])
csvParse.main_func(csv.reader(open('R06_GENMON.csv', 'rb')), ['RT', 'TA'])
csvParse.main_func(csv.reader(open('R06_MPI ECHAM5.csv', 'rb')), ['RT', 'TA'])
csvParse.main_func(csv.reader(open('R06_PRISM.csv', 'rb')), ['ppt', 'tmx', 'tmn'])
csvParse.main_func(csv.reader(open('R06_DAYMET.csv', 'rb')), ['prcp', 'tmax', 'tmin'])
csvParse.main_func(csv.reader(open('R06_Gridded Observed Data(1949-2010).csv', 'rb')), ['Prcp', 'Tavg'])