示例#1
0
def make_new_cat():
    """
    Make new category
    """
    coll_ltr = collocate_locations.transpose()

    td = {
        'Low altitude sites (less than 1000 m a.s.l.)': 'LA',
        'High altitude sites (over 1000 m a.s.l.)': 'HA'
    }
    coll_ltr['AC'] = coll_ltr['Altitude category'].apply(lambda x: td[x])

    coll_ltr['new_cat'] = coll_ltr['AC'] + ': ' + coll_ltr['Region']
    coll_ltr = coll_ltr.sort_values('new_cat', ascending=False)
    return coll_ltr
示例#2
0
def get_ordered_stations(cat=dall_c, sorter=sorter):
    coll_ltr = collocate_locations.transpose()
    coll_ltr = pd_custom_sort_values(coll_ltr, sorter, cat)
    return coll_ltr.index
示例#3
0
        ax.set_xlabel('Month')
    if nrows == 1 and ncols == 1:
        axl = [axs]
    elif nrows == 1:
        axl = [axs[0]]
    elif ncols == 1:
        axl = axs
    else:
        axl = axs[:, 0]
    for ax in axl:
        ax.set_ylabel('%s [#/cm$^3$]' % var)
    return fig, figname_ext, labels, lines


# %%
coll_ltr = collocate_locations.transpose()


# %%
def plt_station(_df, _df_16, _df_84, ax, st, var, ylim,
               yscale='linear'):
    ax.set_xticks(range(1, 12, 2))
    _df_s = _df[_df['station'] == st]
    _df_s16 = _df_16[_df_16['station'] == st]
    _df_s84 = _df_84[_df_84['station'] == st]
    x = _df_s['month']
    y = _df_s
    lines = []
    labels = []
    for source in _df_s['source'].unique():
        _df_ss16 = _df_s16[_df_s16['source'] == source].set_index('month').reindex(range(1, 13))
示例#4
0
from sectional_v2.constants import get_outdata_path, collocate_locations
import xarray as xr
from pathlib import Path
import shutil

# %%
from sectional_v2.util.practical_functions import make_folders

dir_collocated = get_outdata_path('collocated')

locs_t = collocate_locations.transpose()

# %%


# %%
# %%
def fix_coord_station(ds):
    # %%
    both_coords = get_ds_old_stationc2new()
    both_coords
    # %%
    ds['nstation'] = both_coords['nstation']
    ds_n = ds.rename({'station': 'station_tab', 'nstation': 'station'})
    ds_n = ds_n.swap_dims({'station_tab': 'station'})
    return ds_n  #ds_n['station'].values


# %%
def get_ds_old_stationc2new():
    alt_c = 'Alternative_code'