Esempio n. 1
0
    def test_ADAGUCFeatureFunctions_testdatanc(self):
        AdagucTestTools().cleanTempDir()
        filenamenc = "test_ADAGUCFeatureFunctions_testdata.nc"
        filenamecsv = "test_ADAGUCFeatureFunctions_testdata.csv"

        print "Writing to " + self.testresultspath + filenamenc

        ADAGUCFeatureCombineNuts(
            featureNCFile="countries.geojson",
            dataNCFile="testdata.nc",
            bbox="0,50,10,55",
            time="*",
            variable="testdata",
            width=80,
            height=80,
            outncfile=os.getcwd() + "/" + self.testresultspath + filenamenc,
            outcsvfile=os.getcwd() + "/" + self.testresultspath + filenamecsv,
            tmpFolderPath="/tmp")
        # AdagucTestTools().writetofile(self.testresultspath + filename,data.getvalue())
        self.assertEqual(
            AdagucTestTools().readfromfile(self.testresultspath + filenamenc),
            AdagucTestTools().readfromfile(self.expectedoutputsspath +
                                           filenamenc))
        self.assertEqual(
            AdagucTestTools().readfromfile(self.testresultspath + filenamecsv),
            AdagucTestTools().readfromfile(self.expectedoutputsspath +
                                           filenamecsv))
    def test_ADAGUCFeatureFunctions_testdatanc(self):
        AdagucTestTools().cleanTempDir()
        filenamencraster = "test_ADAGUCFeatureFunctions_testdata_raster.nc"
        filenamencpoint = "test_ADAGUCFeatureFunctions_testdata_point.nc"
        filenamecsv = "test_ADAGUCFeatureFunctions_testdata.csv"

        def progressCallback(message, percentage):
            #print "testCallback:: "+message+" "+str(percentage)
            return

        ADAGUCFeatureCombineNuts(
            featureNCFile="countries.geojson",
            #dataNCFile = "myfile.nc",
            dataNCFile="testdata.nc",
            bbox="0,50,10,55",
            time=None,
            variable="testdata",
            #variable="index",
            width=800,
            height=800,
            outncrasterfile=os.getcwd() + "/" + self.testresultspath +
            filenamencraster,
            outncpointfile=os.getcwd() + "/" + self.testresultspath +
            filenamencpoint,
            outcsvfile=os.getcwd() + "/" + self.testresultspath + filenamecsv,
            tmpFolderPath="/tmp",
            callback=progressCallback)
        #AdagucTestTools().writetofile(self.testresultspath + filename,data.getvalue())
        # Comparing binary NetCDF is difficult
        #self.assertEqual(
        #AdagucTestTools().readfromfile(self.testresultspath + filenamencraster), AdagucTestTools().readfromfile(self.expectedoutputsspath + filenamencraster))
        self.assertEqual(
            AdagucTestTools().readfromfile(self.testresultspath + filenamecsv),
            AdagucTestTools().readfromfile(self.expectedoutputsspath +
                                           filenamecsv))
Esempio n. 3
0
    def test_ADAGUCFeatureFunctions_testdatanc(self):
        filenamencraster = "test_ADAGUCFeatureFunctions_testdata_raster.nc"
        filenamencpoint = "test_ADAGUCFeatureFunctions_testdata_point.nc"
        filenamecsv = "test_ADAGUCFeatureFunctions_testdata.csv"

        def progressCallback(message, percentage):
            print "Progress:: " + message + " " + str(percentage)
            return

        # data files need to reside in adaguc-server/data/datasets
        ADAGUCFeatureCombineNuts(
            featureNCFile="countries.geojson",
            dataNCFile=
            "testdata.nc",  #data files need to reside in adaguc-server/data/datasets
            variable="testdata",  #Variable to use should be given
            #dataNCFile="out_icclim.nc",
            #variable="SU",
            bbox="0,50,10,55",
            time="*",
            width=800,
            height=800,
            outncrasterfile=os.getcwd() + "/" + self.testresultspath +
            filenamencraster,
            outncpointfile=os.getcwd() + "/" + self.testresultspath +
            filenamencpoint,
            outcsvfile=os.getcwd() + "/" + self.testresultspath + filenamecsv,
            tmpFolderPath="/tmp",
            callback=progressCallback)
Esempio n. 4
0
 def test_ADAGUCFeatureFunctions_testdatanc(self):
     AdagucTestTools().cleanTempDir()
     filenamencraster="test_ADAGUCFeatureFunctions_testdata_raster.nc"
     filenamencpoint="test_ADAGUCFeatureFunctions_testdata_point.nc"
     filenamecsv="test_ADAGUCFeatureFunctions_testdata.csv"
     def progressCallback(message,percentage):
         #print "testCallback:: "+message+" "+str(percentage)
         return
    
     ADAGUCFeatureCombineNuts(
         featureNCFile = "countries.geojson",
         dataNCFile = "myfile.nc",
         #dataNCFile = "testdata.nc",
         bbox= "0,50,10,55",
         time= "*",
         #variable="testdata",
         variable="index", 
         width=800,
         height=800,
         outncrasterfile=os.getcwd() + "/"+ self.testresultspath + filenamencraster,
         outncpointfile=os.getcwd() + "/"+ self.testresultspath + filenamencpoint,
         outcsvfile=os.getcwd() + "/"+ self.testresultspath + filenamecsv, 
         tmpFolderPath="/tmp",
         callback=progressCallback)