diff --git a/dynamic/palm_dynamic.py b/dynamic/palm_dynamic.py index 17f4836c0a463be1b62444fbbf20b79732807707..81ae4a01987e2081fbdfbd5202fe7a61631239d7 100644 --- a/dynamic/palm_dynamic.py +++ b/dynamic/palm_dynamic.py @@ -214,7 +214,7 @@ print('cent_lon, cent_lat:', cent_lon, cent_lat) irange = origin_x + dx * (np.arange(nx, dtype='f8') + .5) jrange = origin_y + dy * (np.arange(ny, dtype='f8') + .5) palm_grid_y, palm_grid_x = np.meshgrid(jrange, irange, indexing='ij') -transformer2 = Transformer.from_crs(inproj, lonlatproj,always_xy=True) +transformer2 = Transformer.from_crs(inproj, lonlatproj, always_xy=True) palm_grid_lon, palm_grid_lat = transformer2.transform(palm_grid_x, palm_grid_y) ###################################### @@ -360,13 +360,15 @@ for wrf_file in wrf_files_proc: # create list of variables # dynamical variables wrfchem_dynamic = ['PH', 'PHB', 'HGT', 'T', 'W', 'TSLB', 'SMOIS', 'MU', 'MUB','P', 'PB', 'PSFC'] + # add chemical species if included if len(wrfchem_spec)>0: wrfchem_variables = wrfchem_dynamic + wrfchem_spec # add aerosol species if included - N_avr = 6.022e23 # Avargardo constant - inv_den = f_wrf.variables['ALT'][0] # inverse density + N_avr = 6.022e23 # Avargardo constant + inv_den = f_wrf.variables['ALT'][0] # Inverse density + t00 = f_wrf.variables['T00'][0] # Perturbation pt to standard (T00 wrf-chem variable) for varname in wrfchem_variables: # gaseous aerosols @@ -487,7 +489,7 @@ for wrf_file in wrf_files_proc: print('Vertical interpolation...') palm_wrf_utils.palm_wrf_vertical_interp(hinterp_file, vinterp_file, wrf_file, z_levels, z_levels_stag, z_soil_levels, origin_z, terrain, - wrf_hybrid_levs, vinterp_terrain_smoothing, nz, ny, nx) + wrf_hybrid_levs, vinterp_terrain_smoothing, nz, ny, nx, t00) if radiation_from_wrf: print('Start processing of radiation inputs from the WRF radiation files.') diff --git a/dynamic/palm_dynamic_output.py b/dynamic/palm_dynamic_output.py index e96b284e66da9251305191d182bc820cd8229779..87b59879da0e501742d59f464ff230fe04e82caa 100644 --- a/dynamic/palm_dynamic_output.py +++ b/dynamic/palm_dynamic_output.py @@ -325,7 +325,7 @@ def palm_dynamic_output(wrf_files, interp_files, dynamic_driver_file, times_sec, if (var == 'soil_m' or var == 'soil_t' or var == 'u' or var == 'v' or var == 'w'): continue else: - if (var == 'h2so4' or var=='hno3' or var== 'nh3' or var== 'ocnv' or var== 'ocsv'): + if (var == 'h2so4' or var=='hno3' or var== 'nh3' or var== 'ocnv' or var== 'ocsv' or var == 'no' or var == 'no2' or var == 'no3'): var = var.upper() init_var= infile.variables['init_atmosphere_'+ var.lower()] diff --git a/dynamic/palm_wrf_utils.py b/dynamic/palm_wrf_utils.py index d38f081e7069f2ac6726a92cde10782b4facab7f..fd64b8f30223cc1d41e289f895052e39e17635c0 100644 --- a/dynamic/palm_wrf_utils.py +++ b/dynamic/palm_wrf_utils.py @@ -219,7 +219,7 @@ def calc_gp(f, ph): return np.array(gp) def palm_wrf_vertical_interp(infile, outfile, wrffile, z_levels, z_levels_stag, - z_soil_levels, origin_z, terrain, wrf_hybrid_levs, vinterp_terrain_smoothing,nz,ny,nx): + z_soil_levels, origin_z, terrain, wrf_hybrid_levs, vinterp_terrain_smoothing, nz, ny, nx, t00_raw): zdim = len(z_levels) zwdim = len(z_levels_stag) @@ -232,7 +232,6 @@ def palm_wrf_vertical_interp(infile, outfile, wrffile, z_levels, z_levels_stag, os.remove(infile+'_vinterp.log') except: pass - nc_infile = netCDF4.Dataset(infile, 'r') nc_wrf = netCDF4.Dataset(wrffile, 'r') nc_outfile = netCDF4.Dataset(outfile, "w", format="NETCDF4") @@ -303,7 +302,7 @@ def palm_wrf_vertical_interp(infile, outfile, wrffile, z_levels, z_levels_stag, vdata = nc_outfile.createVariable('init_atmosphere_qv', "f4", ("Time", "z","south_north","west_east")) vdata[0,:,:,:] = init_atmosphere_qv # ======================= POTENTIAL TEMPERATURE ========================== - pt_raw = nc_infile.variables['T'][0] + 290. # from perturbation pt to standard (T00 wrf-chem variable) + pt_raw = nc_infile.variables['T'][0] + t00_raw pt_raw = np.r_[pt_raw[0:1], pt_raw] init_atmosphere_pt = interpolate_1d(z_levels, height, pt_raw)