factory = AppleGridFactory()
target_year = factory.getTargetYear(start_date)

plot_options = \
fromConfig('crops.apple.variety.plots.options.hardiness_vs_temp').copy()
plot_options['coords'] = coords
plot_options['location'] = location
plot_options['variety'] = variety.description
temp_units = plot_options.temp_units

# initialize figure and GCA
figure = pyplot.figure(figsize=plot_options.figsize, dpi=100)
axis = figure.gca()

# read the reported mint for the current season
reader = factory.getTempGridReader(target_year)
# turn start/end dates into a list of date indexes
start, end = reader._indexesForDates('reported.mint', start_date, end_date)
days = N.array([day for day in range(1, (end - start) + 1)])

# get minimum temperatures
mint = reader.getDateAtNode('reported.mint',
                            lon,
                            lat,
                            start_date,
                            end_date,
                            units=temp_units)
reader.close()
# draw the mint line
pyplot.plot(days, mint, c='k', label='Minimum Temp')
ymax = N.nanmax(mint)
    errmsg = 'Invalid number of arguments (%d).' % num_args
    raise ValueError, errmsg

factory = AppleGridFactory()
target_year = factory.getTargetYear(start_date)

# 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")
warnings.filterwarnings('ignore', "Mean of empty slice")
# MUST ALSO TURN OFF WARNING FILTERS AT END OF SCRIPT !!!!!

# get mint from temperature file
temp_reader = factory.getTempGridReader(target_year, test_file)
if forecast:
    mint = temp_reader.getTemp('forecast.mint', start_date, end_date)
else:
    temp_start = start_date + ONE_DAY
    if end_date is None:
        mint = temp_reader.getTemp('reported.mint', temp_start, None)
    else:
        temp_end = end_date + ONE_DAY
        mint = temp_reader.getTemp('reported.mint', temp_start, temp_end)
temp_reader.close()
del temp_reader

# get a Variety grid manager for the target year
variety_manager = \
    factory.getVarietyGridManager(target_year, variety, 'a', test_file)