import os import climate_plots as cp from Figures import ReportFigures import pandas as pd figures = ReportFigures() figures.set_style(style='timeseries', width='single') inputfolder = 'D:/ATLData/Fox-Wolf/data' outpdf = 'D:/ATLData/Fox-Wolf/Fox-Wolf_growing_season.pdf' csvs = [os.path.join(inputfolder, c) for c in os.listdir(inputfolder) if 'growing_season' in c] dfs = {} for c in csvs: df = pd.read_csv(c, index_col=0, parse_dates=True) scenario = os.path.split(c)[-1].split('_')[0] dfs[scenario] = df props = {'sresa1b': {'color': 'Tomato', 'zorder': -2, 'alpha': 0.5}, 'sresa2': {'color': 'SteelBlue', 'zorder': -3, 'alpha': 0.5}, 'sresb1': {'color': 'Yellow', 'zorder': -1, 'alpha': 0.5}, } fig, ax = cp.timeseries(dfs, ylabel='Growing season length (days)', props=props, title='', plotstyle=figures.plotstyle) # plotstyle dict as argument to override some Seaborn settings fig.savefig(outpdf, dpi=300)
import os import numpy as np import pandas as pd from collections import defaultdict import datetime as dt import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages import PRMSio import textwrap import sys sys.path.append('../Postprocessing') import climate_plots as cp try: from Figures import ReportFigures figures = ReportFigures() figures.set_style() except: 'Figures module not found; needed for USGS report formatting' # inputs datadir = 'D:/ATLData/BlackEarth/input' # contains existing PRMS .data files # growing season parameters uniform = False # T/F; T: one growing season for entire domain (incomplete option), F: growing season by hru nhru = 880 # only needed if growing_output = True frost_temp = 28.0 growing_output = False # if True, generate .day files, otherwise just plots (much faster) real_data_periods = ['1961-2000', '2046-2065', '2081-2100'] # for labeling non-synthetic data on plots
import plot_and_table_functions as ptf from matplotlib.backends.backend_pdf import PdfPages from Figures import ReportFigures from scipy.interpolate import InterpolatedUnivariateSpline import glob # 31.9, 34.3 = min, max precipitation values for central sands for 1981-2010 # mean min temp (C) = 0.8 to 2 (33.4 to 35.6 F) # mean max temp (C) = 12.07 to 13.68 (53.7 to 56.6 F) if len(sys.argv) >= 1: output_path = sys.argv[1] else: output_path = '.' rf = ReportFigures() rf.set_style() # functions to convert between feet and meters def meters_to_feet(x): return (x * 3.28084) def feet_to_meters(x): return (x * 0.3048) # functions to convert between cubic meter per day and cubic feet per second def cu_meters_day_to_cfs(x): return (x * 0.000408734569)
import os import climate_plots as cp from Figures import ReportFigures import pandas as pd figures = ReportFigures() figures.set_style(style='timeseries', width='single') inputfolder = 'D:/ATLData/Fox-Wolf/data' outpdf = 'D:/ATLData/Fox-Wolf/Fox-Wolf_growing_season.pdf' csvs = [ os.path.join(inputfolder, c) for c in os.listdir(inputfolder) if 'growing_season' in c ] dfs = {} for c in csvs: df = pd.read_csv(c, index_col=0, parse_dates=True) scenario = os.path.split(c)[-1].split('_')[0] dfs[scenario] = df props = { 'sresa1b': { 'color': 'Tomato', 'zorder': -2, 'alpha': 0.5 }, 'sresa2': { 'color': 'SteelBlue', 'zorder': -3,
__author__ = 'aleaf' import os import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1 import ImageGrid import matplotlib.patheffects as PathEffects from matplotlib.colors import LinearSegmentedColormap import textwrap import climate_stats as cs import GSFLOW_utils as GSFu from Figures import ReportFigures rf = ReportFigures() rf.set_style() ''' #--modify the base rcParams for a few items newparams = {'font.family': 'Univers 57 Condensed Light', 'legend.fontsize': 8, 'axes.labelsize': 9, 'xtick.labelsize': 8, 'ytick.labelsize': 8, 'pdf.fonttype': 42, 'pdf.compression': 0, 'axes.formatter.limits': [-7, 9]} # Update the global rcParams dictionary with the new parameter choices plt.rcParams.update(newparams)
import sys, os import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import pandas as pd import datetime from Figures import ReportFigures from matplotlib import cm from datetime import date from datetime import timedelta from dateutil.parser import parse import matplotlib.dates as mdates from dateutil.relativedelta import relativedelta # Use USGS report styles rf = ReportFigures() rf.set_style() sys.path.append('..') python_exe = sys.executable #open irrigation segment file again to read lines fname1 = open(r"..\input\prms\jh_coef_month_high.in", "r") fname2 = open(r"..\input\prms\jh_coef_month_low.in", "r") Kc_high, Kc_low = [], [] # Read Kc values lines1 = fname1.readlines() lines2 = fname2.readlines() # set high Kc values
import sys, os import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import pandas as pd import datetime from Figures import ReportFigures from matplotlib import cm from datetime import date from datetime import timedelta from dateutil.parser import parse import matplotlib.dates as mdates from dateutil.relativedelta import relativedelta # Load USGS report styles rf = ReportFigures() rf.set_style() sys.path.append('..') python_exe = sys.executable # calculate number of lines in file can be any gage file num_lines = 0 with open(r"..\output_GSFLOW_only\modflow\sagehensfr18_HighTrig.out", 'r') as f: for line in f: num_lines += 1 # set dates for daily values; this date is simulation starte date dates = [] for i in range(num_lines - 1): dates.append(datetime.date(1990, 10, 1) + datetime.timedelta(days=i))
import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import pandas as pd import datetime from Figures import ReportFigures from matplotlib import cm from datetime import date from datetime import timedelta from dateutil.parser import parse import matplotlib.dates as mdates from dateutil.relativedelta import relativedelta #%matplotlib inline # Use USGS report styles rf = ReportFigures() rf.set_style() sys.path.append('..') python_exe = sys.executable # calculate number of lines in file can be any gage file num_lines = 0 with open(r".\output\Agwater1SW_high.ts9", 'r') as f: for line in f: num_lines += 1 # set dates for daily values; this date is simulation starte date dates = [] for i in range(num_lines - 1): dates.append(datetime.date(2014, 10, 1) + datetime.timedelta(days=i))