Ejemplo n.º 1
0
        event, species, lat_e, lon_e, obs_datetimes, model_datetimes,
        obs_ts_grp, model_ts_grp, obs_period_grp, model_period_grp, obs_refs,
        tags, loc_dict, obs_d_waveform, obs_s_waveform, obs_all_waveform,
        model_d_waveform, model_s_waveform, model_all_waveform, fig, all_m)


#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 = []
    
    #get info of weather regimes through model fit.
    grad1,grad2,grad3,bp1,bp2,bp_periods,bp_mag = modules.spectra_fit(periods,mag,ofac)
    
    #get mean of values
    mean_array = np.average(vals)

    #correct all phases for start point
    ph = modules.phase_start_point_correct_all(periods,ph,valid_times)

    #convert phase to time(days)
    ph = modules.convert_phase_units_actual_all(ph,periods)
        
    return (x,periods,mag,ph,grad1,grad2,grad3,bp1,bp2,bp_mag)

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)   

lat_i = 0
lon_i = 0

for siten in range(n_boxes):
    linear_data.append(model_std_var[:,lat_i,lon_i])
   
    lat_indices.append(lat_i)
    lon_indices.append(lon_i)
   
    if lon_i == (len(lon_c)-1):
        lat_i+=1
        lon_i=0
    else:
        lon_i+=1
Ejemplo n.º 3
0
        year2100s = 2097
        year2100e = 2100

    #read in 2000 model period data
    f2000 = '/work/home/db876/plotting_tools/model_files/%s_SURFACE_2000_2012_*_*_*_H_*.nc' % (
        model)

    #read in 2100 model period data
    f2100 = '/work/home/db876/plotting_tools/model_files/%s_SURFACE_2095_2111_*_*_*_H_rcp85.nc' % (
        model)

    #read in 2100 model fixed emissions period data
    f2100e = '/work/home/db876/plotting_tools/model_files/%s_SURFACE_2095_2111_*_*_*_H_rcp85em2000.nc' % (
        model)

    f2000raw_time, f2000ref_time, f2000datetime_time, f2000std_var, lat_e, lon_e, lat_c, lon_c, grid_size, gridbox_count = modules.read_model_all(
        f2000, 'O3', year2000s, year2000e)
    if model != 'GISSE2R':
        f2100raw_time, f2100ref_time, f2100datetime_time, f2100std_var, lat_e, lon_e, lat_c, lon_c, grid_size, gridbox_count = modules.read_model_all(
            f2100, 'O3', year2100s, year2100e)
    if model != 'CMAM':
        f2100eraw_time, f2100eref_time, f2100edatetime_time, f2100estd_var, lat_e, lon_e, lat_c, lon_c, grid_size, gridbox_count = modules.read_model_all(
            f2100e, 'O3', year2100s, year2100e)

    count = 0
    for ax in axes.flat:
        try:
            area = areas[count]
        except:
            ax.axis('off')
            continue