71 const Agenda& forloop_agenda,
80 for (
Index i=start; i<=stop; i+=step)
82 out1 <<
" Executing for loop body, index: " << i <<
"\n";
106 if (direction==
"row")
108 if( index >= m.
nrows() )
111 os <<
"The index " << index
112 <<
" is outside the row range of the Matrix.";
113 throw runtime_error( os.str() );
118 v = m( index,
joker );
120 else if (direction==
"column")
122 if( index >= m.
ncols() )
125 os <<
"The index " << index
126 <<
" is outside the column range of the Matrix.";
127 throw runtime_error( os.str() );
132 v = m(
joker, index );
137 os <<
"Keyword *direction* must be either *row* or *column*,"
138 <<
"but you gave: " << direction <<
".";
139 throw runtime_error( os.str() );
150 const Index& ybatch_start,
151 const Index& ybatch_n,
152 const Agenda& ybatch_calc_agenda,
161 bool is_first =
true;
162 Index first_ybatch_index = 0;
179 Index job_counter = 0;
184 bool store_jacobians =
false;
186 while (is_first && first_ybatch_index < ybatch_n)
190 out2 <<
" Job " << job_counter <<
" of " << ybatch_n
191 <<
": Index " << ybatch_start+first_ybatch_index <<
"\n";
198 ybatch_start+first_ybatch_index,
203 ybatch.
resize( y.nelem(), ybatch_n);
216 if (Knr!=0 || Knc!=0)
218 store_jacobians =
true;
222 out0 <<
"First dimension of Jacobian must have same length as the measurement *y*.\n"
223 <<
"Length of *y*: " << y.nelem() <<
"\n"
224 <<
"Dimensions of *jacobian*: (" << Knr <<
", " << Knc <<
")\n";
232 ybatch_jacobians.resize(ybatch_n);
242 ybatch(
joker, first_ybatch_index) = y;
245 ybatch_jacobians[first_ybatch_index] = jacobian;
248 catch (runtime_error e)
252 out0 <<
"WARNING! Job failed. Output variable ybatch will be set\n"
253 <<
"to -1 for this job. The runtime error produced was:\n"
263 throw runtime_error(e.what());
266 first_ybatch_index++;
272 Agenda l_ybatch_calc_agenda(ybatch_calc_agenda);
283 #pragma omp parallel for \
284 if(!arts_omp_in_parallel()) \
285 firstprivate(l_ws, l_ybatch_calc_agenda) \
287 for(
Index ybatch_index = first_ybatch_index;
288 ybatch_index<ybatch_n;
295 l_job_counter = ++job_counter;
300 os <<
" Job " << l_job_counter <<
" of " << ybatch_n
301 <<
", Index " << ybatch_start+ybatch_index <<
", Thread-Id "
311 ybatch_start+ybatch_index,
312 l_ybatch_calc_agenda );
316 ybatch(
joker, ybatch_index ) = y;
319 ybatch_jacobians[ybatch_index] = jacobian;
322 catch (runtime_error e)
327 os <<
"WARNING! Job failed. Output variable ybatch will be set\n"
328 <<
"to -1 for this job. The runtime error produced was:\n"
353 const Agenda& met_profile_calc_agenda,
355 const Matrix& met_amsu_data,
360 const Index& atmosphere_dim,
363 const Index& nelem_p_grid,
364 const String& met_profile_path,
365 const String& met_profile_pnd_path,
384 vmr_field_raw.resize(abs_species.
nelem());
391 pnd_field_raw.resize(N_pt);
413 for (
Index i = 0; i < no_profiles; ++ i)
415 ostringstream lat_os, lon_os;
418 if(lat[i] < 0) lat_prec--;
422 if(
abs(lat[i])>=100 ) lat_prec--;
425 lat_os.setf (ios::showpoint | ios::fixed);
426 lat_os << setprecision((
int)lat_prec) << lat[i];
429 if(lon[i] < 0) lon_prec--;
433 if(
abs(lon[i])>=100 ) lon_prec--;
435 lon_os.setf (ios::showpoint | ios::fixed);
436 lon_os << setprecision((
int)lon_prec) << lon[i];
439 180.0 - (asin(r_geoid(0,0) * sin(sat_za_from_data[i] *
DEG2RAD) /sensor_pos(0,0)))*
RAD2DEG;
442 xml_read_from_file(met_profile_path +
"profile.lat_"+lat_os.str()+
".lon_"+lon_os.str() +
".t.xml",
443 t_field_raw, verbosity);
446 xml_read_from_file(met_profile_path +
"profile.lat_"+lat_os.str()+
".lon_"+lon_os.str() +
".z.xml",
447 z_field_raw, verbosity);
450 xml_read_from_file(met_profile_path +
"profile.lat_"+lat_os.str()+
".lon_"+lon_os.str() +
".H2O.xml",
451 vmr_field_raw[0], verbosity);
458 xml_read_from_file(met_profile_pnd_path +
"lwc_reff15/profile.lat_"+lat_os.str()+
".lon_"+lon_os.str() +
".pnd15.xml",
459 pnd_field_raw[0], verbosity);
464 z_surface(0,0) = z_field_raw.
data(0,0,0);
478 vmr_field_raw[1].resize(vmr_field_raw[0]);
479 vmr_field_raw[1].copy_grids(vmr_field_raw[0]);
480 vmr_field_raw[1] = 0.782;
486 vmr_field_raw[2].resize(vmr_field_raw[0]);
487 vmr_field_raw[2].copy_grids(vmr_field_raw[0]);
488 vmr_field_raw[2] = 0.209;
505 Numeric cl_grid_min, cl_grid_max;
509 cl_grid_min = tfr_p_grid[0];
512 Index level_counter = 0;
515 for (
Index ip = 0; ip< N_p; ++ip)
520 if(pnd_field_raw[0].data(ip, 0, 0) > 0.001)
527 cl_grid_max = tfr_p_grid[ip +1];
532 cloudbox_limits.resize( atmosphere_dim*2 );
537 if(level_counter == 0)
539 cl_grid_max = p_grid[1];
562 z_field_raw, pnd_field_raw, p_grid,
563 sensor_los, cloudbox_on,
564 cloudbox_limits, z_surface,
565 met_profile_calc_agenda );
582 const Agenda& met_profile_calc_agenda,
584 const Matrix& met_amsu_data,
588 const Index& nelem_p_grid,
589 const String& met_profile_path,
598 Index cloudbox_on = 0;
608 vmr_field_raw.resize(abs_species.
nelem());
613 Vector sat_za_from_profile;
614 sat_za_from_profile = met_amsu_data(
Range(
joker),3);
627 for (
Index i = 0; i < no_profiles; ++ i)
629 ostringstream lat_os, lon_os;
632 if(lat[i] < 0) lat_prec--;
636 if(
abs(lat[i])>=100 ) lat_prec--;
639 lat_os.setf (ios::showpoint | ios::fixed);
640 lat_os << setprecision((
int)lat_prec) << lat[i];
643 if(lon[i] < 0) lon_prec--;
647 if(
abs(lon[i])>=100 ) lon_prec--;
649 lon_os.setf (ios::showpoint | ios::fixed);
650 lon_os << setprecision((
int)lon_prec) << lon[i];
651 cout<<lat_os.str()<<endl;
652 cout<<lon_os.str()<<endl;
655 sat_za = sat_za_from_profile[i];
660 180.0 - (asin(r_geoid(0,0) * sin(sat_za *
PI/180.) /sensor_pos(0,0)))*180./
PI;
661 cout<<
"sensor_los"<<sat_za_from_profile[i]<<endl;
662 cout<<
"sensor_los"<<sat_za<<endl;
663 cout<<
"sensor_los"<<sensor_los<<endl;
666 xml_read_from_file(met_profile_path +
"profile.lat_"+lat_os.str()+
".lon_"+lon_os.str() +
".t.xml",
667 t_field_raw, verbosity);
669 xml_read_from_file(met_profile_path +
"profile.lat_"+lat_os.str()+
".lon_"+lon_os.str() +
".z.xml",
670 z_field_raw, verbosity);
675 xml_read_from_file(met_profile_path +
"profile.lat_"+lat_os.str()+
".lon_"+lon_os.str() +
".H2O.xml",
676 vmr_field_raw_h2o, verbosity);
680 cout <<
"--------------------------------------------------------------------------"<<endl;
681 cout <<
"The file" << met_profile_path +
"profile.lat_"+lat_os.str()+
".lon_"+lon_os.str()<<
"is executed now"<<endl;
682 cout <<
"--------------------------------------------------------------------------"<<endl;
688 z_surface(0,0) = z_field_raw.
data(0,0,0);
689 cout<<
"z_surface"<<z_surface<<endl;
693 vmr_field_raw[0] = vmr_field_raw_h2o;
699 vmr_field_raw[1].resize(vmr_field_raw[0]);
700 vmr_field_raw[1].copy_grids(vmr_field_raw[0]);
707 vmr_field_raw[2].resize(vmr_field_raw[0]);
708 vmr_field_raw[2].copy_grids(vmr_field_raw[0]);
722 cout<<
"t_field_raw[0](0,0,0)"<<tfr_p_grid[0]<<endl;
723 cout<<
"t_field_raw[0](N_p -1,0,0)"<<tfr_p_grid[N_p -1] <<endl;
728 z_field_raw, pnd_field_raw, p_grid,
729 sensor_los, cloudbox_on,
730 cloudbox_limits, z_surface,
731 met_profile_calc_agenda );