Exemplo n.º 1
0
@author: Tim Armstrong
'''
import unittest
import PyDFlow.app.paths as app_paths
from PyDFlow.app import *
import os.path
import glob
import time

import logging
from PyDFlow.tests.PyDFlowTest import PyDFlowTest
from PyDFlow.app.exceptions import ExitCodeException, AppLaunchException
#logging.basicConfig(level=logging.DEBUG)

testdir = os.path.dirname(__file__)
app_paths.add_path(os.path.join(testdir, "apps"))


@app((localfile), (None))
def write(str):
    return App("myecho", outfiles[0], str)


@app((localfile), (localfile))
def cp(src):
    return App("cp", src, outfiles[0])


class TestApp(PyDFlowTest):
    def setUp(self):
        pass
Exemplo n.º 2
0
@author: Tim Armstrong
'''
import unittest
import PyDFlow.app.paths as app_paths
from PyDFlow.app import *
import os.path
import glob
import time

import logging
from PyDFlow.tests.PyDFlowTest import PyDFlowTest
from PyDFlow.app.exceptions import ExitCodeException, AppLaunchException
#logging.basicConfig(level=logging.DEBUG)

testdir = os.path.dirname(__file__)
app_paths.add_path(os.path.join(testdir, "apps"))


@app((localfile), (None))
def write(str):
    return App("myecho", outfiles[0], str)

@app((localfile), (localfile))
def cp(src):
    return App("cp", src, outfiles[0])

class TestApp(PyDFlowTest):
    def setUp(self):
        pass
    def tearDown(self):
        pass
Exemplo n.º 3
0
import logging
logging.basicConfig(level=logging.INFO)

if len(sys.argv) not in (2, 3):
    print "USAGE: modis.py <directory with modis *.tif files> [optional output directory]"
    exit(1)
modisdir = sys.argv[1]
if len(sys.argv) == 3:
    outputdir = sys.argv[2]
else:
    outputdir = modisdir

# Add the modis shell scripts to PyDFlow search path
srcdir = os.path.dirname(__file__)
app_paths.add_path(os.path.join(srcdir, "bin"))

imagefile = localfile.subtype()

landuse = localfile.subtype()


@app((landuse), (imagefile, int))
def getLandUse(input, sortfield):
    return App("getlanduse.sh", input, sortfield, stdout=outfiles[0])


@app((localfile, localfile), (int, int, Multiple(landuse)))
def analyzeLandUse(usetype, maxnum, *inputs):
    return App("analyzelanduse.sh", outfiles[0], outfiles[1], usetype, maxnum,
               modisdir, *inputs)
Exemplo n.º 4
0
# See the License for the specific language governing permissions and
# limitations under the License.

#!/usr/bin/python
from PyDFlow.app import *
from PyDFlow.base.patterns import treereduce
import datetime
import sys
import logging
import PyDFlow.app.paths as app_paths
import os.path

#logging.basicConfig(level=logging.DEBUG)

srcdir = os.path.dirname(__file__)
app_paths.add_path(srcdir)

app_count = 0

intfile = localfile.subtype()
sorted_intfile = intfile.subtype()


@app((sorted_intfile), (intfile))
def sort(file):
    return App("sort", "-n", file, "-o", outfiles[0])


@app((sorted_intfile), (sorted_intfile, sorted_intfile))
def merge(f1, f2):
    return App("merge", f1, f2, outfiles[0])
Exemplo n.º 5
0
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from PyDFlow.app import *
from montage_types import *
import os.path as path
from PyDFlow import Multiple


import PyDFlow.app.paths as app_paths

# Add the montage binaries to PyDFlow search path
srcdir = path.dirname(__file__)
app_paths.add_path(path.join('/var/tmp/code/Montage_v3.3', "bin"))
app_paths.add_path('/var/tmp/code/SwiftApps/Montage/scripts')

@app((MImage) ,(MTable, MosaicData, Multiple(MImage)))
def mAdd(img_tbl, hdr, *imgs):
    """
    returns mosaic from adding together images.
    img_tbl specifies images to be added,
    all images must be in same directory
    """
    mos = outfiles[0]
    return App("mAdd", "-p", path.dirname(imgs[0]), "-n", img_tbl, hdr, mos)


@app((MImage) ,(MImage, float, float, float))
def mBackground(img, a, b, c):
Exemplo n.º 6
0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from PyDFlow.app import *
from montage_types import *
import os.path as path
from PyDFlow import Multiple

import PyDFlow.app.paths as app_paths

# Add the montage binaries to PyDFlow search path
srcdir = path.dirname(__file__)
app_paths.add_path(path.join('/var/tmp/code/Montage_v3.3', "bin"))
app_paths.add_path('/var/tmp/code/SwiftApps/Montage/scripts')


@app((MImage), (MTable, MosaicData, Multiple(MImage)))
def mAdd(img_tbl, hdr, *imgs):
    """
    returns mosaic from adding together images.
    img_tbl specifies images to be added,
    all images must be in same directory
    """
    mos = outfiles[0]
    return App("mAdd", "-p", path.dirname(imgs[0]), "-n", img_tbl, hdr, mos)


@app((MImage), (MImage, float, float, float))
Exemplo n.º 7
0
import logging
logging.basicConfig(level=logging.INFO)

if len(sys.argv) not in (2, 3):
    print "USAGE: modis.py <directory with modis *.tif files> [optional output directory]" 
    exit(1)
modisdir = sys.argv[1]
if len(sys.argv) == 3:
    outputdir = sys.argv[2]
else:
    outputdir = modisdir


# Add the modis shell scripts to PyDFlow search path
srcdir = os.path.dirname(__file__)
app_paths.add_path(os.path.join(srcdir, "bin"))



imagefile = localfile.subtype()

landuse = localfile.subtype()

@app((landuse), (imagefile, int)) 
def getLandUse(input, sortfield):
    return App("getlanduse.sh", input, sortfield, stdout=outfiles[0])

@app((localfile, localfile), (int, int, Multiple(landuse)))
def analyzeLandUse(usetype, maxnum, *inputs):
    return App("analyzelanduse.sh", outfiles[0], outfiles[1], usetype, maxnum, modisdir, *inputs)
Exemplo n.º 8
0
# limitations under the License.

#!/usr/bin/python
from PyDFlow.app import *
from PyDFlow.base.patterns import treereduce
import datetime
import sys
import logging 
import PyDFlow.app.paths as app_paths
import os.path


#logging.basicConfig(level=logging.DEBUG)

srcdir = os.path.dirname(__file__)
app_paths.add_path(srcdir)

app_count = 0

intfile = localfile.subtype()
sorted_intfile = intfile.subtype()


@app((sorted_intfile), (intfile))
def sort(file):
    return App("sort", "-n", file, "-o", outfiles[0])

@app((sorted_intfile), (sorted_intfile, sorted_intfile))
def merge(f1, f2):
    return App("merge", f1, f2, outfiles[0])