import numpy as np import xarray as xr from ds21grl.misc import get_dim_exp from ds21grl.read_aqua import read_yt_zm_sfc_daily from ds21grl.write_data import write_yt_zm_sfc_daily from ds21grl.config import data_name, dir_raw_aqua, dir_processed # INPUT ----------------------------------------------------------- data_name_local = data_name[1:10] var_name = ['FLDS', 'LWCFS'] write2file = 0 # ----------------------------------------------------------------- for exp in data_name_local: for var in var_name: print('dataset: ' + exp, ', variable: ' + var) # get dimensions dim = get_dim_exp(exp) # define paths dir_in = dir_raw_aqua + exp + '/' dir_out = dir_processed + exp + '/' # read data data = read_yt_zm_sfc_daily(var, dir_in, dim) # write to file write_yt_zm_sfc_daily(data, var, dir_out, dim, write2file)
# INPUT ----------------------------------------------------------- data_name_local = data_name[2:10] var = 'VQ' flag = 'eddy' season_name = ['ANNUAL', 'NDJFM'] write2file = 0 # ----------------------------------------------------------------- for exp in data_name_local: for season in season_name: print('dataset: ' + exp, ', season: ' + season) # get dimensions dim = get_dim_exp(exp) dim_ctl = get_dim_exp(data_name[1]) # define paths dir_in_exp = dir_processed + exp + '/' dir_in_ctl = dir_processed + data_name[1] + '/' dir_out = dir_interim + exp + '/' # read data filename = dir_in_exp + 'ykt_zint_vint_ml_daily_' + var + '_' + flag + '_' + dim.timestamp + '.nc' ds = xr.open_dataset(filename) data = ds[var].values ds.close() # read control data filename = dir_in_ctl + 'ykt_zint_vint_ml_daily_' + var + '_' + flag + '_' + dim_ctl.timestamp + '.nc'