def __init__(self, case_name, from_time, to_time, isSectional, time_res, space_res='full', model_name='NorESM', history_field='.h0.', raw_data_path=constants.get_input_datapath(), locations=constants.collocate_locations, read_from_file=True, chunks=None, use_pressure_coords=False, dataset=None, savepath_root=constants.get_outdata_path('collocated')): """ :param case_name: :param from_time: :param to_time: :param raw_data_path: :param isSectional: :param time_res: 'month', 'year', 'hour' :param space_res: 'full', 'locations' :param model_name: """ self.chunks = chunks self.read_from_file = read_from_file self.model_name = model_name # self.case_plotting_name = model_name self.dataset = None self.use_pressure_coords = use_pressure_coords self.case_name_nice = find_model_case_name.find_name( model_name, case_name) self.case_name = case_name self.raw_data_path = raw_data_path self.from_time = from_time self.to_time = to_time self.time_resolution = time_res self.space_resolution = space_res self.history_field = history_field self.locations = locations self.isSectional = isSectional self.locations = constants.collocate_locations self.dataset = dataset self.savepath_root = savepath_root self.attrs_ds = dict(raw_data_path=self.raw_data_path, model=self.model_name, model_name=self.model_name, case_name=self.case_name, case=self.case_name, case_name_nice=self.case_name_nice, isSectional=str(self.isSectional), from_time=self.from_time, to_time=self.to_time)
def get_pressure_coord_fields(case, varlist, from_time, to_time, history_field, comp='atm', model='NorESM', path_raw_data=constants.get_input_datapath(), save_field=True):
# %% from sectional_v2.util.plot.combination_plots import plot_sizedist_time_cases, \ plot_seasonal_surface_loc_sizedistributions avg_over_lev = True # True#True#False#True pressure_adjust = True # Can only be false if avg_over_lev false. Plots particular hybrid sigma lev if avg_over_lev: pressure_adjust = True cases_sec = ['PD_SECT_CHC7_diur_ricc_incC','PD_SECT_CHC7_diur_ricc', 'PD_SECT_CHC7_diurnal']# , 'PD_SECT_CHC7_diur_ricc_incC'] cases_orig = ['PD_noSECT_nudgeERA_eq_ricc','PD_noSECT_nudgeERA_eq20']#'Original eq.20'] # , 'Original eq.18','Original eq.20, 1.5xBVOC','Original eq.20, rednuc'] cases = cases_sec + cases_orig models = ['NorESM'] Path_local = constants.get_input_datapath(models[0]) history_field ='.h1.' Path = {'NorESM': Path_local} from_t = '2008-01-01' to_t = '2009-01-01' nr_of_bins = 5 maxDiameter = 39.6 # 23.6 #e-9 minDiameter = 5.0 # e-9 time_resolution = 'month' # %% log.ger.setLevel(log.log.WARNING)
def __init__(self, case_name, from_time, to_time, dlim_sec, isSectional, time_res, raw_data_path=constants.get_input_datapath(), space_res='full', nr_bins=5, print_stat=False, model_name='NorESM', history_field='.h0.', locations=constants.locations, chunks={'diameter': 20}, use_pressure_coords=True, use_eusaar_diam=True): """ :param case_name: :param from_time: :param to_time: :param raw_data_path: :param dlim_sec: :param isSectional: :param time_res: 'month', 'year', 'hour' :param space_res: 'full', 'locations' :param print_stat: :param model_name: """ self.chunks = chunks self.dmin_sec = dlim_sec[0] self.dmax_sec = dlim_sec[1] self.nr_bins = nr_bins bin_diam, bin_diam_int = self.get_sectional_params() self.bin_diameter_int = bin_diam_int self.bin_diameter = bin_diam if use_eusaar_diam: d_arr = distc_var.get_diameter_sized() else: d_arr = np.logspace(np.log10(3), 4, 50) # np.logspace(0, 4, 50) self.diameter = xr.DataArray(d_arr, name='diameter', coords=[d_arr], dims='diameter', attrs={'units': 'nm'}) # self.read_from_file = read_from_file self.model_name = model_name # self.case_plotting_name = model_name self.dataset = None self.use_pressure_coords = use_pressure_coords self.case_name_nice = find_model_case_name.find_name( model_name, case_name) self.case_name = case_name self.raw_data_path = raw_data_path self.from_time = from_time self.to_time = to_time self.time_resolution = time_res self.space_resolution = space_res self.history_field = history_field self.locations = locations self.isSectional = isSectional self.final_sizedist_vars = self.varl_sizedist_final() # self.savepath_sizedist = self.dataset_savepath(case_name, model_name) self.print = print_stat self.attrs_ds = dict(raw_data_path=self.raw_data_path, model=self.model_name, model_name=self.model_name, case_name=self.case_name, case=self.case_name, case_name_nice=self.case_name_nice, isSectional=str(self.isSectional), from_time=self.from_time, to_time=self.to_time, time_resolution=self.time_resolution, history_field=self.history_field, pressure_coords=str(self.use_pressure_coords)) # self.size_dtset = self.get_sizedistrib_dataset() # self.attrs = vars(self self.dmin_sec = dlim_sec[0] return