def get_tasks_for_base_plots_for_next_few_days(cls): """ Grabs the files ID's of NCDF datafiles that haven't been plotted yet. Use this function to generate a list of unchopped plots that haven't been plotted yet. """ file_ids = [] file_ids.append(DataFileManager.get_next_few_datafiles_of_a_type('NCDF')) # OSU ROMS file_ids.append(DataFileManager.get_next_few_datafiles_of_a_type('NCEP')) # Wave Forecast file_ids.append(DataFileManager.get_next_few_datafiles_of_a_type('WIND')) # Wind file_ids.append(DataFileManager.get_next_few_datafiles_of_a_type('T-CLINE')) # T-Cline file_ids.append(DataFileManager.get_next_few_datafiles_of_a_type('HYCOM')) # Hycom - Extended file_ids = [item for sublist in file_ids for item in sublist] # Unravel lists of lists return cls.get_tasks_for_base_plots_in_files(file_ids)
def get_tasks_for_base_plots_for_next_few_days(cls): """ Grabs the files ID's of NCDF datafiles that haven't been plotted yet. Use this function to generate a list of unchopped plots that haven't been plotted yet. """ file_ids = [] file_ids.append( DataFileManager.get_next_few_datafiles_of_a_type( 'NCDF')) # OSU ROMS file_ids.append( DataFileManager.get_next_few_datafiles_of_a_type( 'NCEP')) # Wave Forecast file_ids.append( DataFileManager.get_next_few_datafiles_of_a_type('WIND')) # Wind file_ids.append( DataFileManager.get_next_few_datafiles_of_a_type( 'T-CLINE')) # T-Cline file_ids.append( DataFileManager.get_next_few_datafiles_of_a_type( 'HYCOM')) # Hycom - Extended file_ids = [item for sublist in file_ids for item in sublist] # Unravel lists of lists return cls.get_tasks_for_base_plots_in_files(file_ids)
def plot_latest(num_plots=DEF_NUM_PLOTS, tile=DEF_TILE_FLAG, full_roms=DEF_FULL_ROMS_FLAG, date='latest', roms=False, wave=False, wind=False, hycom=False, ncep=False, tcline=False, navy=False): # num_plots = The number of plots you want for each file - save time! # Pull the latest files from the database and plot those """ Using `latest` grabs all plots into the future. Similar to do_pipeline() """ from pl_download.models import DataFile as df from pl_download.models import DataFileManager as dm from datetime import datetime if verbose > 0: print "Date span request: ", date # Today if date == 'today': today = datetime.now().date() print "Printing all datafiles with date of today" elif date == 'all': print "Printing all datafiles" pass elif date == 'latest': print "Printing datafiles that start with PAST_FILES_TO_DISPALY until whats returned from \n" print "get_next_few_days_files_from_db(days=x)" pass elif date is None: print "Printing datafiles that start with PAST_FILES_TO_DISPALY until whats returned from \n" print "get_next_few_days_files_from_db(days=x)" date = 'latest' else: print "Wrong date paramater. Please use - 'today', 'all', or 'latest'" return if roms: roms = [] ids = [] if date == "today": ids = df.objects.filter(type='NCDF').get(model_date=today) elif date == "latest": ids = dm.get_next_few_datafiles_of_a_type(type ='NCDF') elif date == "all": ids = df.objects.all().filter(type = "NCDF") print ids ids = [id.id for id in ids] # Unwrap ids plot( ids, roms=True, num_plots=num_plots, tile=tile, full_roms=full_roms ) if wave: waves = [] ids = [] if date == "today": ids = df.objects.filter(type='WAVE').get(model_date=today) elif date == "latest": ids = dm.get_next_few_datafiles_of_a_type(type ='WAVE') elif date == "all": ids = df.objects.all().filter(type = "WAVE") ids = [id.id for id in ids] # Unwrap ids plot( ids, wave=True, num_plots=num_plots, tile=tile ) if wind: winds = [] ids = [] if date is "today": ids = df.objects.filter(type='WIND').get(model_date=today) elif date is "latest": ids = dm.get_next_few_datafiles_of_a_type(type ='WIND') elif date is "all": ids = df.objects.all().filter(type = "WIND") ids = [id.id for id in ids] # Unwrap ids plot(ids, wind=True, num_plots=num_plots, tile=tile ) if hycom: hycoms = [] if date == "today": ids = df.objects.filter(type='HYCOM').get(model_date=today) elif date == "latest": ids = dm.get_next_few_datafiles_of_a_type(type ='HYCOM') elif date == "all": ids = df.objects.all().filter(type = "HYCOM") ids = [id.id for id in ids] # Unwrap ids plot( ids, hycom=True, num_plots=num_plots, tile=tile ) if ncep: nceps = [] ids = [] if date is "today": ids = df.objects.filter(type='NCEP_WW3').get(model_date=today) elif date is "latest": ids = dm.get_next_few_datafiles_of_a_type(type ='NCEP_WW3') elif date is "all": ids = df.objects.all().filter(type = "NCEP_WW3") ids = [id.id for id in ids] # Unwrap ids plot( ids, ncep=True, num_plots=num_plots, tile=tile ) if tcline: tcline = [] ids = [] if date is "today": ids = df.objects.filter(type='T-CLINE').get(model_date=today) elif date is "latest": ids = dm.get_next_few_datafiles_of_a_type(type ='T-CLINE') elif date is "all": ids = df.objects.all().filter(type = "T-CLINE") ids = [id.id for id in ids] # Unwrap ids plot( ids, tcline=True, num_plots=num_plots, tile=tile ) if navy: navys = [] ids = [] if date is "today": ids = df.objects.filter(type='HYCOM').get(model_date=today) elif date is "latest": ids = dm.get_next_few_datafiles_of_a_type(type ='HYCOM') elif date is "all": ids = df.objects.all().filter(type = "HYCOM") ids = [id.id for id in ids] # Unwrap ids plot( ids, navy=True, num_plots=num_plots, tile=tile ) print "MANAGE.PY: FINISH TEST"