예제 #1
0
parser = OptionParser()

parser.add_option('-v', action='store_true', dest='verbose', default=False)

options, args = parser.parse_args()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

verbose = options.verbose

# apple variety config
variety = getGrapeVariety(args[0])
group_name = args[1]
prov_dataset_name = '%s.provenance' % group_name

factory = GrapeGridFactory()

# get the date
date_args = args[2:]
num_date_args = len(date_args)
if num_date_args == 1:
    target_year = int(date_args[0])
    start_date = None
    end_date = None
elif num_date_args >= 3:
    year = int(date_args[0])
    month = int(date_args[1])
    day = int(date_args[2])
    start_date = datetime(year,month,day)
    if num_date_args == 3: end_date = None
    elif num_date_args == 4:
parser.add_option('-v', action='store_true', dest='verbose', default=False)
parser.add_option('-z', action='store_true', dest='test_file', default=False)

options, args = parser.parse_args()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

animate = options.animate
delay = options.delay
test_file = options.test_file
verbose = options.verbose

# apple variety config
variety = getGrapeVariety(args[0])

factory = GrapeGridFactory()

# get the date
date_args = len(args[1:])
if date_args == 1:
    target_year = int(args[1])
    start_date = datetime(target_year, 1, 1)
    end_date = datetime(target_year, 5, 15)
elif date_args >= 3:
    year = int(args[1])
    month = int(args[2])
    day = int(args[3])
    start_date = datetime(year, month, day)
    if date_args == 3: end_date = None
    elif date_args == 4:
        end_date = start_date + relativedelta(days=int(args[4]) - 1)
예제 #3
0
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

from optparse import OptionParser

parser = OptionParser()

parser.add_option('-c', action='store', dest='coords', default=None)
parser.add_option('-l', action='store', dest='location', default=None)
parser.add_option('-z', action='store_true', dest='test_file', default=False)

options, args = parser.parse_args()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

factory = GrapeGridFactory()

test_file = options.test_file

# grape variety config
variety = getGrapeVariety(args[0])

# get the date span
date_args = args[1:]
num_date_args = len(date_args)
if num_date_args == 1:
    target_year = int(date_args[0])
    start_date, end_date = factory.getTargetDateSpan(target_year)
elif num_date_args >= 3:
    year = int(date_args[0])
    month = int(date_args[1])
예제 #4
0
parser.add_option('-u', action='store_false', dest='update', default=True)
parser.add_option('-v', action='store_true', dest='verbose', default=False)
parser.add_option('-y', action='store_true', dest='test_run', default=False)
parser.add_option('-z', action='store_true', dest='debug', default=False)

options, args = parser.parse_args()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

debug = options.debug
test_run = options.test_run
verbose = options.verbose or debug
update_db = options.update

factory = GrapeGridFactory()

variety = getGrapeVariety(args[0])

num_date_args = len(args[1:])
if num_date_args == 0:
    start_date = datetime.now()
    end_date = None
elif num_date_args == 1:
    target_year = int(args[1])
    start_date, end_date = factory.getTargetDateSpan(target_year)
elif num_date_args == 2:
    year = int(args[1])
    month = int(args[2])
    start_date = datetime(year, month, 1)
    last_day = lastDayOfMonth(year, month)
예제 #5
0
parser.add_option('-v', action='store_true', dest='verbose', default=False)
parser.add_option('-z', action='store_true', dest='test_file', default=False)

options, args = parser.parse_args()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

animate = options.animate
delay = options.delay
test_file = options.test_file
verbose = options.verbose

# apple variety config
variety = getGrapeVariety(args[0])

factory = GrapeGridFactory()

# get the date
date_args = len(args[1:])
if date_args == 1:
    target_year = int(args[1])
    start_date = datetime(target_year, 1, 1)
    end_date = datetime(target_year, 5, 15)
elif date_args >= 3:
    year = int(args[1])
    month = int(args[2])
    day = int(args[3])
    start_date = datetime(year, month, day)
    if date_args == 3: end_date = None
    elif date_args == 4:
        end_date = start_date + relativedelta(days=int(args[4]) - 1)
예제 #6
0
parser.add_option('-u', action='store_false', dest='update', default=True)
parser.add_option('-v', action='store_true', dest='verbose', default=False)
parser.add_option('-z', action='store_true', dest='debug', default=False)

options, args = parser.parse_args()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

debug = options.debug
update = options.update
verbose = options.verbose or debug

variety = getGrapeVariety(args[0])

factory = GrapeGridFactory()

num_args = len(args[1:])
if num_args in (3, 4, 6):
    year = int(args[1])
    month = int(args[2])
    day = int(args[3])
    start_date = datetime(year, month, day)
    if num_args == 3: end_date = start_date
    elif num_args == 4:
        end_date = start_date + relativedelta(days=int(args[4]) - 1)
    elif num_args == 6:
        year = int(args[4])
        month = int(args[5])
        day = int(args[6])
        end_date = datetime(year, month, day)
예제 #7
0
parser.add_option('-v', action='store_true', dest='verbose', default=False)
parser.add_option('-x', action='store_true', dest='test_file', default=False)
parser.add_option('-z', action='store_true', dest='debug', default=False)

options, args = parser.parse_args()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

debug = options.debug
from_temp = options.from_temp
test_file = options.test_file
verbose = options.verbose or debug

target_year = int(args[0])
grape_variety = args[1]
grape_factory = GrapeGridFactory()

# filter annoying numpy warnings
warnings.filterwarnings('ignore', "All-NaN axis encountered")
warnings.filterwarnings('ignore', "All-NaN slice encountered")
warnings.filterwarnings('ignore', "invalid value encountered in greater")
warnings.filterwarnings('ignore', "invalid value encountered in less")
# MUST ALSO TURN OFF WARNING FILTERS AT END OF SCRIPT !!!!!

if from_temp:
    from frost.factory import FrostGridFactory
    from frost.grape.builder import GrapeVarietyGridBuilder

    start_date, end_date = grape_factory.getTargetDateSpan(target_year)

    frost_factory = FrostGridFactory()