def mapFilepath(self, date, model, map_group, map_type, lo_gdd_th, hi_gdd_th, test_file=False): # get the map directory path and the template for the map file name map_dirpath = mapWorkingDir(self.target_year, self.variety.name, model.name, map_group, map_type, lo_gdd_th, hi_gdd_th, test_file) filename_template = mapFilename('%s', self.variety.name, model.name, map_group, map_type, lo_gdd_th, hi_gdd_th, test_file) filepath_template = map_dirpath + os.sep + filename_template return filepath_template % asAcisQueryDate(date)
# map type if args[2] == 'chill': map_group = 'chill' map_type = 'accumulated' else: map_group, map_type = args[2].split('.') # generate a set of parameters for each plot plots = [ ] for model_name in model_names: plots.append( (None, model_name, map_group, map_type) ) for variety, model_name, map_group, map_type in plots: if debug: print '\nanimating', variety, model_name, map_group, map_type map_filepath = \ mapFilename('date', variety, model_name, map_group, map_type) if map_type == 'gdd': plot_key = 'GDD' else: plot_key = nameToFilepath(map_type) png_path = '*%s' % map_filepath[map_filepath.find(plot_key):] anim_filepath = \ animationFilepath(target_year, variety, model_name, map_group, map_type) working_dir = \ mapWorkingDir(target_year, variety, model_name, map_group, map_type) os.chdir(working_dir) _cmd_ = _cmd_tmpl_ % (png_path, anim_filepath) if debug: print _cmd_ os.system(_cmd_)
errmsg = 'Invalid number of date arguments (%d).' % date_args raise ValueError, errmsg else: errmsg = 'Invalid number of date arguments (%d).' % date_args raise ValueError, errmsg if end_date is None: past_date = start_date + ONE_DAY else: past_date = end_date + ONE_DAY factory = AppleGridFactory() target_year = factory.getTargetYear(start_date) # get the map directory path and the template for the map file name map_dirpath = mapWorkingDir(target_year, variety.name, model.name, 'chill', dataset, None, None, test_file) filename_template = mapFilename('%s', variety.name, model.name, 'chill', dataset, None, None, test_file) filepath_template = map_dirpath + os.sep + filename_template # get the map title template and initialize the map title title_template = fromConfig('crops.apple.chill.maps.titles.accumulated') title = title_template % { 'model': model.description, } # get GDD map options map_options = fromConfig('crops.apple.chill.maps.options.accumulated.attrs') # get date indepenedent attributes and grids from the stage grid manager manager = factory.getChillGridManager(target_year, 'r', test_file) lats = manager.lats lons = manager.lons