From dd1e611231b5f3dbd311d46aa540d0986696264f Mon Sep 17 00:00:00 2001 From: magpowell Date: Tue, 19 Nov 2024 08:59:53 -0800 Subject: [PATCH] add override sza and azi option --- src_test/test_rte_rrtmgp_rt.cu | 43 ++++++++++++++++++++++++++++++---- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/src_test/test_rte_rrtmgp_rt.cu b/src_test/test_rte_rrtmgp_rt.cu index 267c8dc..20d43f7 100644 --- a/src_test/test_rte_rrtmgp_rt.cu +++ b/src_test/test_rte_rrtmgp_rt.cu @@ -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> 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; @@ -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))) @@ -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."); @@ -665,9 +682,25 @@ void solve_radiation(int argc, char** argv) rad_sw.load_mie_tables("mie_lut_broadband.nc"); } + Array mu0({n_col}); + Array 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("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("azi", {n_col_y, n_col_x}); + } - Array mu0(input_nc.get_variable("mu0", {n_col_y, n_col_x}), {n_col}); - Array azi(input_nc.get_variable("azi", {n_col_y, n_col_x}), {n_col}); Array sfc_alb_dir(input_nc.get_variable("sfc_alb_dir", {n_col_y, n_col_x, n_bnd_sw}), {n_bnd_sw, n_col}); Array sfc_alb_dif(input_nc.get_variable("sfc_alb_dif", {n_col_y, n_col_x, n_bnd_sw}), {n_bnd_sw, n_col});