def make_BoxWhisker(self, Trawl_Data, Var, Chronological=False, Chronological_data=[], Log=False): ''' Creates boxwhisker plots for properly set up data. Instead of coming from trawl observed data, data is post processed into csv files containing the q5, q25, q50, q75, and q95 (q meaning quantile) statistics. These values are used for creating boxwhisker plots. q5 = 5% quantile, bottom whisker q25 = 25% quantile, bottom of the box q50 = 50% quantile, middle of the box q75 = 75% quantile, top of the box q95 = 95% quantile, top whisker variable controls including chronological and Log scaling. If Chronological, user must include a pairing trawl csv file that contains dates for each survey and region. Inputs: Trawl_Data: pre processed csv file full path containing data. Var: plot type variable. Abundance or Density Chronological: Boolean to turn on Chronological plotting. If True, bars are ordered by the survey date, not the load order Chronological_data: list set of data to correspond with the trawl data. Only needed if Chronological is passed in as True Log: Plots data with a log scale instead of a true scale. Can make data with a large variation easier to view. ''' bw_data = DataManager(self.Map_Utils.poly_names, self.Year, self.Sizes, self.Surveys, 'Boxwhisker', '') bw_data.InitializeData(Trawl_Data) bw_data.apply_Chronological(Chronological, Chronological_data=Chronological_data) data = bw_data.get_DataFrame() self.Map_Utils.plot_boxwhisker(data, Var, Chronological, Log) self.Map_Utils.savePlot(Var)
def make_Bars(self, Trawl_Data, static_volumes, Var, Chronological=False, GrowthRate=0.0, startDate=dt.datetime(1900, 1, 1), Log=False, max=0., Fishtype='Longfin Smelt'): ''' Makes Bar Plots and organizes data for plotting. Allows for variable commands to customize plots. Inputs: Trawl_Data: csv file full pathe mm/dd/YYYY HH:MM formatted date of the sample. Hour and minute data is typically 00:00 and does not matter. Fields also required:h containing data. Trawl files must contain a 'SampleDate' field containing t lfs_region, Survey, Year failure to contain these regions will result in a script crash. static_volumes: File containing volume of water used for abundance calculations. Must have an entry for each region. Var: plot type variable. Abundance or Density Chronological: Boolean to turn on Chronological plotting. If True, bars are ordered by the survey date, not the load order GrowthRate: Decimal number value for growth in mm / day. If set to a non zero value, the script will calculate new abundances and densities based the new surveys calculated by the growth rate. Changes survey numbers per region based on how many days from hatch and growth rate. startDate: Excludes values that were surveyed before the specified date Log: Plots data with a log scale instead of a true scale. Can make data with a large variation easier to view. ''' bar_data = DataManager(self.Map_Utils.poly_names, self.Year, self.Sizes, 'Bar', static_volumes, self.Groups, self.Group_Type, startDate=startDate) bar_data.InitializeData(Trawl_Data) bar_data.apply_Growth(GrowthRate) bar_data.apply_Chronological(Chronological) data = bar_data.get_DataFrame() self.Map_Utils.plot_bars(data, Var, GrowthRate, Chronological, Log, Fishtype, startDate, max=max) self.Map_Utils.savePlot(Var, self.output_directory)