Skip to content

Commit

Permalink
add override sza and azi option
Browse files Browse the repository at this point in the history
  • Loading branch information
magpowell committed Nov 19, 2024
1 parent c1ae705 commit dd1e611
Showing 1 changed file with 38 additions and 5 deletions.
43 changes: 38 additions & 5 deletions src_test/test_rte_rrtmgp_rt.cu
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,15 @@ void solve_radiation(int argc, char** argv)
{"single-gpt" , { false, "Output optical properties and fluxes for a single g-point. '--single-gpt 100': output 100th g-point" }},
{"profiling" , { false, "Perform additional profiling run." }},
{"delta-cloud" , { false, "delta-scaling of cloud optical properties" }},
{"delta-aerosol" , { false, "delta-scaling of aerosol optical properties" }} };
{"delta-aerosol" , { false, "delta-scaling of aerosol optical properties" }} ,
{"override-sza" , { false, "override provided value of sza in input file. IN DEGREES. '--override-sza 50': use a sza of 50 degrees" }},
{"override-azi" , { false, "override provided value of azi in input file. IN DEGREES. '--override-azi 240': use of azi of 240 degrees" }}};

std::map<std::string, std::pair<int, std::string>> command_line_ints {
{"raytracing", {32, "Number of rays initialised at TOD per pixel per quadraute."}},
{"single-gpt", {1 , "g-point to store optical properties and fluxes of" }} };
{"single-gpt", {1 , "g-point to store optical properties and fluxes of" }},
{"override-sza", {0, "solar zenith angle (theta) in degrees."}},
{"override-azi", {0, "Solar azimuth angle in degrees."}} };

if (parse_command_line_options(command_line_switches, command_line_ints, argc, argv))
return;
Expand All @@ -262,7 +266,8 @@ void solve_radiation(int argc, char** argv)
const bool switch_profiling = command_line_switches.at("profiling" ).first;
const bool switch_delta_cloud = command_line_switches.at("delta-cloud" ).first;
const bool switch_delta_aerosol = command_line_switches.at("delta-aerosol" ).first;

const bool override_sza = command_line_switches.at("override-sza" ).first;
const bool override_azi = command_line_switches.at("override-azi" ).first;

Int photons_per_pixel = Int(command_line_ints.at("raytracing").first);
if (Float(int(std::log2(Float(photons_per_pixel)))) != std::log2(Float(photons_per_pixel)))
Expand Down Expand Up @@ -296,9 +301,21 @@ void solve_radiation(int argc, char** argv)
print_command_line_options(command_line_switches, command_line_ints);

int single_gpt = command_line_ints.at("single-gpt").first;
int sza_deg = Int(command_line_ints.at("override-sza").first);
int azi_deg = Int(command_line_ints.at("override-azi").first);

Status::print_message("Using "+ std::to_string(photons_per_pixel) + " rays per pixel");

if (override_sza)
{
Status::print_message("Using SZA of "+ std::to_string(sza_deg) + " degrees");
}

if (override_azi)
{
Status::print_message("Using azi of "+ std::to_string(azi_deg) + " degrees");
}

////// READ THE ATMOSPHERIC DATA //////
Status::print_message("Reading atmospheric input data from NetCDF.");

Expand Down Expand Up @@ -665,9 +682,25 @@ void solve_radiation(int argc, char** argv)
rad_sw.load_mie_tables("mie_lut_broadband.nc");
}

Array<Float,1> mu0({n_col});
Array<Float,1> azi({n_col});

if (override_sza) {
Float mu0_in = cosf(sza_deg * 3.14159f / 180.0f);
for (int icol=1; icol<=n_col; ++icol)
mu0({icol}) = mu0_in;
} else {
mu0 = input_nc.get_variable<Float>("mu0", {n_col_y, n_col_x});
}

if (override_azi) {
Float azi_in = azi_deg * 3.14159f / 180.0f;
for (int icol=1; icol<=n_col; ++icol)
azi({icol}) = azi_in;
} else {
azi = input_nc.get_variable<Float>("azi", {n_col_y, n_col_x});
}

Array<Float,1> mu0(input_nc.get_variable<Float>("mu0", {n_col_y, n_col_x}), {n_col});
Array<Float,1> azi(input_nc.get_variable<Float>("azi", {n_col_y, n_col_x}), {n_col});
Array<Float,2> sfc_alb_dir(input_nc.get_variable<Float>("sfc_alb_dir", {n_col_y, n_col_x, n_bnd_sw}), {n_bnd_sw, n_col});
Array<Float,2> sfc_alb_dif(input_nc.get_variable<Float>("sfc_alb_dif", {n_col_y, n_col_x, n_bnd_sw}), {n_bnd_sw, n_col});

Expand Down

0 comments on commit dd1e611

Please sign in to comment.