64 const Agenda& forloop_agenda,
72 for (
Index i = start;
i <= stop;
i += step) {
73 out1 <<
" Executing for loop body, index: " <<
i <<
"\n";
85 const Index& ybatch_start,
86 const Index& ybatch_n,
87 const Agenda& ybatch_calc_agenda,
93 Index first_ybatch_index = 0;
96 bool do_abort =
false;
108 Index job_counter = 0;
111 ybatch.resize(ybatch_n);
112 ybatch_aux.resize(ybatch_n);
113 ybatch_jacobians.resize(ybatch_n);
114 for (
Index i = 0;
i < ybatch_n;
i++) {
116 ybatch_aux[
i].resize(0);
117 ybatch_jacobians[
i].resize(0, 0);
123 Agenda l_ybatch_calc_agenda(ybatch_calc_agenda);
128 #pragma omp parallel for schedule(dynamic) if (!arts_omp_in_parallel() && \ 130 firstprivate(l_ws, l_ybatch_calc_agenda) 131 for (
Index ybatch_index = first_ybatch_index; ybatch_index < ybatch_n;
135 if (do_abort)
continue;
136 #pragma omp critical(ybatchCalc_job_counter) 137 { l_job_counter = ++job_counter; }
141 os <<
" Job " << l_job_counter <<
" of " << ybatch_n <<
", Index " 142 << ybatch_start + ybatch_index <<
", Thread-Id " 156 ybatch_start + ybatch_index,
157 l_ybatch_calc_agenda);
160 #pragma omp critical(ybatchCalc_assign_y) 161 ybatch[ybatch_index] = y;
162 #pragma omp critical(ybatchCalc_assign_y_aux) 163 ybatch_aux[ybatch_index] = y_aux;
169 if (Knr != 0 || Knc != 0) {
170 if (Knr != y.
nelem()) {
172 os <<
"First dimension of Jacobian must have same length as the measurement *y*.\n" 173 <<
"Length of *y*: " << y.
nelem() <<
"\n" 174 <<
"Dimensions of *jacobian*: (" << Knr <<
", " << Knc
180 #pragma omp critical(ybatchCalc_setabort) 183 throw runtime_error(os.str());
186 ybatch_jacobians[ybatch_index] = jacobian;
192 }
catch (
const std::exception& e) {
193 if (robust && !do_abort) {
195 os <<
"WARNING! Job at ybatch_index " << ybatch_start + ybatch_index
197 <<
"y Vector in output variable ybatch will be empty for this job.\n" 198 <<
"The runtime error produced was:\n" 204 #pragma omp critical(ybatchCalc_setabort) 208 os <<
" Job at ybatch_index " << ybatch_start + ybatch_index
209 <<
" failed. Aborting...\n";
213 os <<
"Run-time error at ybatch_index " << ybatch_start + ybatch_index
216 #pragma omp critical(ybatchCalc_push_fail_msg) 217 fail_msg.push_back(os.str());
221 if (fail_msg.
nelem()) {
224 if (!do_abort) os <<
"\nError messages from failed batch cases:\n";
225 for (ArrayOfString::const_iterator it = fail_msg.begin();
226 it != fail_msg.end();
231 throw runtime_error(os.str());
243 const Agenda& met_profile_calc_agenda,
245 const Matrix& met_amsu_data,
247 const Vector& refellipsoid,
250 const Index& atmosphere_dim,
253 const Index& nelem_p_grid,
254 const String& met_profile_path,
255 const String& met_profile_pnd_path,
273 vmr_field_raw.resize(abs_species.
nelem());
280 pnd_field_raw.resize(N_se);
299 ybatch.resize(no_profiles);
302 for (
Index i = 0;
i < no_profiles; ++
i) {
306 if (lat[
i] < 0) lat_prec--;
307 if (
abs(lat[
i]) >= 10) {
309 if (
abs(lat[i]) >= 100) lat_prec--;
312 lat_os.setf(ios::showpoint | ios::fixed);
313 lat_os << setprecision((
int)lat_prec) << lat[
i];
316 if (lon[i] < 0) lon_prec--;
317 if (
abs(lon[i]) >= 10) {
319 if (
abs(lon[i]) >= 100) lon_prec--;
321 lon_os.setf(ios::showpoint | ios::fixed);
322 lon_os << setprecision((
int)lon_prec) << lon[
i];
325 180.0 - (asin(refellipsoid[0] * sin(sat_za_from_data[i] *
DEG2RAD) /
331 ".lon_" + lon_os.str() +
".t.xml",
337 ".lon_" + lon_os.str() +
".z.xml",
343 ".lon_" + lon_os.str() +
".H2O.xml",
353 lat_os.str() +
".lon_" + lon_os.str() +
".pnd15.xml",
360 z_surface(0, 0) = z_field_raw.
data(0, 0, 0);
374 vmr_field_raw[1].resize(vmr_field_raw[0]);
375 vmr_field_raw[1].copy_grids(vmr_field_raw[0]);
376 vmr_field_raw[1] = 0.782;
382 vmr_field_raw[2].resize(vmr_field_raw[0]);
383 vmr_field_raw[2].copy_grids(vmr_field_raw[0]);
384 vmr_field_raw[2] = 0.209;
386 const Vector& tfr_p_grid =
393 p_grid, nelem_p_grid, tfr_p_grid[0], tfr_p_grid[N_p - 1], verbosity);
399 Numeric cl_grid_min, cl_grid_max;
403 cl_grid_min = tfr_p_grid[0];
406 Index level_counter = 0;
409 for (
Index ip = 0; ip < N_p; ++ip) {
413 if (pnd_field_raw[0].
data(ip, 0, 0) > 0.001) {
419 cl_grid_max = tfr_p_grid[ip + 1];
424 cloudbox_limits.resize(atmosphere_dim * 2);
429 if (level_counter == 0) {
430 cl_grid_max = p_grid[1];
466 met_profile_calc_agenda);
481 const Agenda& met_profile_calc_agenda,
483 const Matrix& met_amsu_data,
485 const Vector& refellipsoid,
487 const Index& nelem_p_grid,
488 const String& met_profile_path,
496 Index cloudbox_on = 0;
506 vmr_field_raw.resize(abs_species.
nelem());
509 ybatch.resize(no_profiles);
511 Vector sat_za_from_profile;
512 sat_za_from_profile = met_amsu_data(
Range(
joker), 3);
525 for (
Index i = 0;
i < no_profiles; ++
i) {
529 if (lat[
i] < 0) lat_prec--;
530 if (
abs(lat[
i]) >= 10) {
532 if (
abs(lat[i]) >= 100) lat_prec--;
535 lat_os.setf(ios::showpoint | ios::fixed);
536 lat_os << setprecision((
int)lat_prec) << lat[
i];
539 if (lon[i] < 0) lon_prec--;
540 if (
abs(lon[i]) >= 10) {
542 if (
abs(lon[i]) >= 100) lon_prec--;
544 lon_os.setf(ios::showpoint | ios::fixed);
545 lon_os << setprecision((
int)lon_prec) << lon[
i];
546 cout << lat_os.str() << endl;
547 cout << lon_os.str() << endl;
549 sat_za = sat_za_from_profile[
i];
553 (asin(refellipsoid[0] * sin(sat_za *
PI / 180.) / sensor_pos(0, 0))) *
555 cout <<
"sensor_los" << sat_za_from_profile[
i] << endl;
556 cout <<
"sensor_los" << sat_za << endl;
557 cout <<
"sensor_los" << sensor_los << endl;
561 ".lon_" + lon_os.str() +
".t.xml",
566 ".lon_" + lon_os.str() +
".z.xml",
574 ".lon_" + lon_os.str() +
".H2O.xml",
581 <<
"--------------------------------------------------------------------------" 584 << met_profile_path +
"profile.lat_" + lat_os.str() +
".lon_" +
586 <<
"is executed now" << endl;
588 <<
"--------------------------------------------------------------------------" 595 z_surface(0, 0) = z_field_raw.
data(0, 0, 0);
596 cout <<
"z_surface" << z_surface << endl;
597 const Vector& tfr_p_grid =
601 vmr_field_raw[0] = vmr_field_raw_h2o;
607 vmr_field_raw[1].resize(vmr_field_raw[0]);
608 vmr_field_raw[1].copy_grids(vmr_field_raw[0]);
615 vmr_field_raw[2].resize(vmr_field_raw[0]);
616 vmr_field_raw[2].copy_grids(vmr_field_raw[0]);
626 p_grid, nelem_p_grid, tfr_p_grid[0], tfr_p_grid[N_p - 1], verbosity);
627 cout <<
"t_field_raw[0](0,0,0)" << tfr_p_grid[0] << endl;
628 cout <<
"t_field_raw[0](N_p -1,0,0)" << tfr_p_grid[N_p - 1] << endl;
643 met_profile_calc_agenda);
657 const Index& ybatch_start,
658 const Index& ybatch_n,
659 const Agenda& dobatch_calc_agenda,
664 Index first_ybatch_index = 0;
667 bool do_abort =
false;
679 Index job_counter = 0;
682 dobatch_cloudbox_field.resize(ybatch_n);
683 dobatch_radiance_field.resize(ybatch_n);
684 dobatch_irradiance_field.resize(ybatch_n);
685 dobatch_spectral_irradiance_field.resize(ybatch_n);
690 Agenda l_dobatch_calc_agenda(dobatch_calc_agenda);
695 #pragma omp parallel for schedule(dynamic) if (!arts_omp_in_parallel() && \ 697 firstprivate(l_ws, l_dobatch_calc_agenda) 698 for (
Index ybatch_index = first_ybatch_index; ybatch_index < ybatch_n;
702 if (do_abort)
continue;
703 #pragma omp critical(dobatchCalc_job_counter) 704 { l_job_counter = ++job_counter; }
708 os <<
" Job " << l_job_counter <<
" of " << ybatch_n <<
", Index " 709 << ybatch_start + ybatch_index <<
", Thread-Id " 718 Tensor5 spectral_irradiance_field;
724 spectral_irradiance_field,
725 ybatch_start + ybatch_index,
726 l_dobatch_calc_agenda);
728 #pragma omp critical(dobatchCalc_assign_cloudbox_field) 729 dobatch_cloudbox_field[ybatch_index] = cloudbox_field;
730 #pragma omp critical(dobatchCalc_assign_radiance_field) 731 dobatch_radiance_field[ybatch_index] = radiance_field;
732 #pragma omp critical(dobatchCalc_assign_irradiance_field) 733 dobatch_irradiance_field[ybatch_index] = irradiance_field;
734 #pragma omp critical(dobatchCalc_assign_spectral_irradiance_field) 735 dobatch_spectral_irradiance_field[ybatch_index] =
736 spectral_irradiance_field;
738 }
catch (
const std::exception& e) {
739 if (robust && !do_abort) {
741 os <<
"WARNING! Job at ybatch_index " << ybatch_start + ybatch_index
743 <<
"element in output variables will be empty for this job.\n" 744 <<
"The runtime error produced was:\n" 750 #pragma omp critical(dobatchCalc_setabort) 754 os <<
" Job at ybatch_index " << ybatch_start + ybatch_index
755 <<
" failed. Aborting...\n";
759 os <<
"Run-time error at ybatch_index " << ybatch_start + ybatch_index
762 #pragma omp critical(dobatchCalc_push_fail_msg) 763 fail_msg.push_back(os.str());
767 if (fail_msg.
nelem()) {
770 if (!do_abort) os <<
"\nError messages from failed batch cases:\n";
771 for (ArrayOfString::const_iterator it = fail_msg.begin();
772 it != fail_msg.end();
777 throw runtime_error(os.str());
INDEX Index
The type to use for all integer numbers and indices.
void ybatchMetProfiles(Workspace &ws, ArrayOfVector &ybatch, const ArrayOfArrayOfSpeciesTag &abs_species, const Agenda &met_profile_calc_agenda, const Vector &f_grid, const Matrix &met_amsu_data, const Matrix &sensor_pos, const Vector &refellipsoid, const Vector &lat_grid, const Vector &lon_grid, const Index &atmosphere_dim, const ArrayOfArrayOfSingleScatteringData &scat_data, const Index &nelem_p_grid, const String &met_profile_path, const String &met_profile_pnd_path, const Verbosity &verbosity)
WORKSPACE METHOD: ybatchMetProfiles.
void cloudboxSetManually(Index &cloudbox_on, ArrayOfIndex &cloudbox_limits, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Numeric &p1, const Numeric &p2, const Numeric &lat1, const Numeric &lat2, const Numeric &lon1, const Numeric &lon2, const Verbosity &)
WORKSPACE METHOD: cloudboxSetManually.
Index nelem() const
Number of elements.
int arts_omp_get_thread_num()
Wrapper for omp_get_thread_num.
void dobatch_calc_agendaExecute(Workspace &ws, Tensor7 &spectral_radiance_field, Tensor5 &radiance_field, Tensor4 &irradiance_field, Tensor5 &spectral_irradiance_field, const Index ybatch_index, const Agenda &input_agenda)
const Index GFIELD3_P_GRID
This file contains basic functions to handle XML data files.
G0 G2 FVC Y DV Numeric Numeric Numeric Zeeman LowerQuantumNumbers void * data
Index nelem() const
Returns the number of elements.
Index ncols() const
Returns the number of columns.
Index TotalNumberOfElements(const Array< Array< base > > &aa)
Determine total number of elements in an ArrayOfArray.
The global header file for ARTS.
void met_profile_calc_agendaExecute(Workspace &ws, Vector &y, const GriddedField3 &t_field_raw, const ArrayOfGriddedField3 &vmr_field_raw, const GriddedField3 &z_field_raw, const ArrayOfGriddedField3 &pnd_field_raw, const Vector &p_grid, const Matrix &sensor_los, const Index cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Matrix &z_surface, const Agenda &input_agenda)
const Vector & get_numeric_grid(Index i) const
Get a numeric grid.
void xml_read_from_file(const String &filename, T &type, const Verbosity &verbosity)
Reads data from XML file.
NUMERIC Numeric
The type to use for all floating point numbers.
void ybatchMetProfilesClear(Workspace &ws, ArrayOfVector &ybatch, const ArrayOfArrayOfSpeciesTag &abs_species, const Agenda &met_profile_calc_agenda, const Vector &f_grid, const Matrix &met_amsu_data, const Matrix &sensor_pos, const Vector &refellipsoid, const Index &nelem_p_grid, const String &met_profile_path, const Verbosity &verbosity)
WORKSPACE METHOD: ybatchMetProfilesClear.
void VectorNLogSpace(Vector &x, const Index &n, const Numeric &start, const Numeric &stop, const Verbosity &verbosity)
WORKSPACE METHOD: VectorNLogSpace.
void DOBatchCalc(Workspace &ws, ArrayOfTensor7 &dobatch_cloudbox_field, ArrayOfTensor5 &dobatch_radiance_field, ArrayOfTensor4 &dobatch_irradiance_field, ArrayOfTensor5 &dobatch_spectral_irradiance_field, const Index &ybatch_start, const Index &ybatch_n, const Agenda &dobatch_calc_agenda, const Index &robust, const Verbosity &verbosity)
WORKSPACE METHOD: DOBatchCalc.
basic_ostringstream< char, string_char_traits< char >, alloc > ostringstream
void ForLoop(Workspace &ws, const Agenda &forloop_agenda, const Index &start, const Index &stop, const Index &step, const Verbosity &verbosity)
WORKSPACE METHOD: ForLoop.
void resize(Index n)
Resize function.
A constant view of a Vector.
constexpr Rational start(Rational Ju, Rational Jl, Polarization type) noexcept
Gives the lowest M for a polarization type of this transition.
void ybatch_calc_agendaExecute(Workspace &ws, Vector &y, ArrayOfVector &y_aux, Matrix &jacobian, const Index ybatch_index, const Agenda &input_agenda)
Header file for helper functions for OpenMP.
void forloop_agendaExecute(Workspace &ws, const Index forloop_index, const Agenda &input_agenda)
void xml_write_to_file(const String &filename, const T &type, const FileType ftype, const Index no_clobber, const Verbosity &verbosity)
Write data to XML file.
This file contains declerations of functions of physical character.
Index nrows() const
Returns the number of rows.
void ybatchCalc(Workspace &ws, ArrayOfVector &ybatch, ArrayOfArrayOfVector &ybatch_aux, ArrayOfMatrix &ybatch_jacobians, const Index &ybatch_start, const Index &ybatch_n, const Agenda &ybatch_calc_agenda, const Index &robust, const Verbosity &verbosity)
WORKSPACE METHOD: ybatchCalc.
Declaration of functions in rte.cc.
void resize(Index r, Index c)
Resize function.