""" This function returns a string with 3 decimal places, given the input x""" return '%.7f' % x xformatter = FuncFormatter(form2) yformatter = FuncFormatter(form5) #get species from current directory present_dir = os.getcwd() obs_fname,species,start_year,end_year,vres,timeres = modules.get_obs_info(present_dir) model_fname,species,start_year,end_year = modules.get_model_info(present_dir) obs_refs,obs_raw_time,obs_ref_time,obs_datetime_time,obs_std_var,obs_lats,obs_lons,obs_alt,obs_gap_inds = modules.read_obs_all(obs_fname,species,start_year,end_year) model_raw_time,model_ref_time,model_datetime_time,model_std_var,lat_e,lon_e,lat_c,lon_c,grid_size,gridbox_count = modules.read_model_all(model_fname,species,start_year,end_year) #get obs lat_lon grid central points obs_lats_centre, obs_lons_centre, model_indices = modules.grid_obs_centre_convergance(lat_e,lon_e,obs_lats,obs_lons) #get observational location tags #EU = europe, AF = africa, NA = north america, SA = south america, ANT = antarctica, ARC = arctic, O = oceanic, OC = oceania, AS = asia tags = modules.get_tags(np.copy(obs_refs)) #-------------------------------------------------------- #load in periodic lsp data obs_period_grp = Dataset('../obs_%s_%s/obs_sig_periods.nc'%(vres,timeres)) model_period_grp = Dataset('model_sig_periods.nc') obs_daily_waveforms = [] obs_seasonal_waveforms = [] model_daily_waveforms = [] model_seasonal_waveforms = []
obs_co_lons = np.append(obs_co_lons, obs_site_group.longitude) obs_co_alt = np.append(obs_co_alt, obs_site_group.altitude) obs_co_date = obs_site_group.variables['date'][:] obs_co_time = obs_site_group.variables['time'][:] for i in range(len(obs_o3_refs)): obs_o3_refs[i] = obs_o3_refs[i].lower() for i in range(len(obs_no2_refs)): obs_no2_refs[i] = obs_no2_refs[i].lower() for i in range(len(obs_co_refs)): obs_co_refs[i] = obs_co_refs[i].lower() #get obs lat_lon grid central points obs_o3_lats_centre, obs_o3_lons_centre, model_o3_indices = modules.grid_obs_centre_convergance( lat_e, lon_e, obs_o3_lats, obs_o3_lons) obs_no2_lats_centre, obs_no2_lons_centre, model_no2_indices = modules.grid_obs_centre_convergance( lat_e, lon_e, obs_no2_lats, obs_no2_lons) obs_co_lats_centre, obs_co_lons_centre, model_co_indices = modules.grid_obs_centre_convergance( lat_e, lon_e, obs_co_lats, obs_co_lons) #get observational location tags #EU = europe, AF = africa, NA = north america, SA = south america, ANT = antarctica, ARC = arctic, O = oceanic, OC = oceania, AS = asia obs_o3_tags = modules.get_tags(obs_o3_refs) obs_no2_tags = modules.get_tags(obs_no2_refs) obs_co_tags = modules.get_tags(obs_co_refs) #cut model data model_o3_data = model_o3_var[:, model_o3_indices[:, 0], model_o3_indices[:, 1]] model_no2_data = model_no2_var[:, model_no2_indices[:, 0], model_no2_indices[:, 1]]
#get species from current directory present_dir = os.getcwd() obs_fname, species, start_year, end_year, vres, timeres = modules.get_obs_info( present_dir) model_fname, species, start_year, end_year = modules.get_model_info( present_dir) obs_refs, obs_raw_time, obs_ref_time, obs_datetime_time, obs_std_var, obs_lats, obs_lons, obs_alt, obs_gap_inds = modules.read_obs_all( obs_fname, species, start_year, end_year) model_raw_time, model_ref_time, model_datetime_time, model_std_var, lat_e, lon_e, lat_c, lon_c, grid_size, gridbox_count = modules.read_model_all( model_fname, species, start_year, end_year) #get obs lat_lon grid central points obs_lats_centre, obs_lons_centre, model_indices = modules.grid_obs_centre_convergance( lat_e, lon_e, obs_lats, obs_lons) #get observational location tags #EU = europe, AF = africa, NA = north america, SA = south america, ANT = antarctica, ARC = arctic, O = oceanic, OC = oceania, AS = asia tags = modules.get_tags(np.copy(obs_refs)) #-------------------------------------------------------- #load in periodic lsp data obs_period_grp = Dataset('../obs_%s_%s/obs_sig_periods.nc' % (vres, timeres)) model_period_grp = Dataset('model_sig_periods.nc') obs_d_waveform = [] obs_s_waveform = [] obs_all_waveform = [] model_d_waveform = [] model_s_waveform = []
obs_site_group = obs_ts_grp.groups[ref] obs_country_o3 = np.append(obs_country_o3,obs_site_group.country) obs_o3.append(obs_site_group.variables[species.lower()][:]) obs_lats_o3 = np.append(obs_lats_o3,obs_site_group.latitude) obs_lons_o3 = np.append(obs_lons_o3,obs_site_group.longitude) obs_alt_o3 = np.append(obs_alt_o3,obs_site_group.altitude) obs_date = obs_site_group.variables['date'][:] obs_time = obs_site_group.variables['time'][:] obs_date = obs_site_group.variables['date'][:] obs_time = obs_site_group.variables['time'][:] for i in range(len(obs_refs_o3)): obs_refs_o3[i] = obs_refs_o3[i].lower() #get obs lat_lon grid central points obs_lats_centre, obs_lons_centre, geoschem_model_indices = modules.grid_obs_centre_convergance(geoschem_lat_e,geoschem_lon_e,obs_lats_o3,obs_lons_o3) #get observational location tags #EU = europe, AF = africa, NA = north america, SA = south america, ANT = antarctica, ARC = arctic, O = oceanic, OC = oceania, AS = asia tags_o3 = modules.get_tags(obs_refs_o3) #cut model data geoschem_o3 = geoschem_o3[:,geoschem_model_indices[:,0],geoschem_model_indices[:,1]] obs_o3 = np.array(obs_o3) #-------------------------------------------------- areas = ['ANT','S_O','OC','AF','SA','NE_NA','CE_NA','SE_NA','S_NA','SW_NA','NW_NA','C_NA','S_EU','C_EU','NW_EU','N_EU','E_EU','NE_AS','SE_AS','C_AS','S_AS','N_O','AL','ARC'] area_boundaries,area_tags,area_labels = modules.area_dicts() fig, axes = plt.subplots(nrows=5, ncols=5,figsize=(19,13))