Example #1
0
#!/usr/bin/env python
import site
import os
import sys

# import the ciop functtons (e.g. copy, log)
sys.path.append('/usr/lib/ciop/python/')
import cioppy as ciop

# add the local packages where ndvi package is deployed
site.addsitedir('/application/share/python/lib')
# import the ndvi package 
import ndvi

# write a log entry
ciop.log('INFO', 'Calculating NDVI')

# create a local output folder for the NDVI results
output_path = os.environ['TMPDIR'] + '/' + 'output' 
os.makedirs(output_path)

# input comes from STDIN (standard input)
for line in sys.stdin:

    # line contains a reference to a catalogue entry
    ciop.log('INFO', 'input: ' + line)
    
    # ciop.copy extracts the path from the reference and downloads the Landsat product
    res = ciop.copy(line, os.environ['TMPDIR'])
    local_path = res[0].rstrip('\n')
Example #2
0
#!/usr/bin/env python
import site
import os
import sys

# import the ciop functtons (e.g. copy, log)
sys.path.append('/usr/lib/ciop/python/')
import cioppy as ciop

# add the local packages where ndvi package is deployed
site.addsitedir('/application/share/python/lib')
# import the ndvi package
import ndvi

# write a log entry
ciop.log('INFO', 'Calculating NDVI')

# create a local output folder for the NDVI results
output_path = os.environ['TMPDIR'] + '/' + 'output'
os.makedirs(output_path)

# input comes from STDIN (standard input)
for line in sys.stdin:

    # line contains a reference to a catalogue entry
    ciop.log('INFO', 'input: ' + line)

    # ciop.copy extracts the path from the reference and downloads the Landsat product
    res = ciop.copy(line, os.environ['TMPDIR'])
    local_path = res[0].rstrip('\n')
#!/usr/bin/env python

# import modules
import os
import sys

# import the cioppy module
sys.path.append('/usr/lib/ciop/python/')
import cioppy as ciop

myparam1 = ciop.getparam("param1")
myparam2 = ciop.getparam("param2")

ciop.log("INFO", "I'm running a job with paramaters " + myparam1 + " " + myparam2)

# input comes from STDIN (standard input)
for line in sys.stdin:
    
    ciop.log('INFO', 'input: ' + line)

    # copy the input to TMPDIR folder (set as an environmental variable)
    res = ciop.copy(line, os.environ['TMPDIR'])

    ciop.log('DEBUG', 'local path:' + res[0].rstrip('\n'))    
  
    # do something with the local path
    
    # publish
    pub = ciop.publish(os.environ['TMPDIR'] + '/myresult')

ciop.log('INFO', 'Done my share of the work!')