Skip to content
Snippets Groups Projects
Commit 089af80b authored by David Jean du Preez (local)'s avatar David Jean du Preez (local)
Browse files

fix outspcies typo

parent 9fe2dba2
No related branches found
No related tags found
1 merge request!26fix outspcies typo
......@@ -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.')
......
......@@ -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()]
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment