parser.add_argument('-n', '--nprocs', help='Number of processes', type=int, default=1) parser.add_argument('-c', '--nocompression', help='do not compress the netcdf file', action='store_true') args = parser.parse_args() modes = args.modes indexes = args.index nl = mht.Read_namelist(args.filename) itot = nl['grid']['itot'] jtot = nl['grid']['jtot'] ktot = nl['grid']['ktot'] starttime = float( args.starttime) if args.starttime is not None else nl['time']['starttime'] endtime = float( args.endtime) if args.endtime is not None else nl['time']['endtime'] sampletime = float( args.sampletime ) if args.sampletime is not None else nl['cross']['sampletime'] if args.modes is None: modes = list(nl['cross'].keys() & cross_modes) else: modes = args.modes
} # MicroHH data type {f4, f8} float_type = 'f8' header('Creating LES input') # Download the ERA5 data (or check whether it is available local) download_ERA5(settings) # Read ERA5 data, and calculate LES forcings, using +/-n_av grid point averages in ERA5 e5 = Read_ERA(settings) e5.calculate_forcings(n_av=1) # Read MicroHH namelist and create stretched vertical grid nl = mht.Read_namelist() grid = mht.Stretched_grid(kmax=128, nloc1=90, nbuf1=20, dz1=20, dz2=50) grid.plot() # Create nudge factor, controlling where nudging is aplied, and time scale tau_nudge = 10800 # Nudge time scale (s) nudge_fac = np.ones(grid.z.size) / tau_nudge # Interpolate ERA5 onto LES grid def interp_time(z, ze, arr): out = np.empty((arr.shape[0], z.size)) for i in range(arr.shape[0]): out[i, :] = np.interp(z, ze[i, :], arr[i, :]) return out