87 const Index& atmosphere_dim )
89 assert( atmosphere_dim >= 1 && atmosphere_dim <= 3 );
91 if( atmosphere_dim == 1 )
93 assert( los.
nelem() == 1 );
94 assert( los[0] > 90 );
95 assert( los[0] <= 180 );
97 los[0] = 180 - los[0];
100 else if( atmosphere_dim == 2 )
102 assert( los.
nelem() == 1 );
103 assert(
abs(los[0]) <= 180 );
105 los[0] =
sign( los[0] ) * 180 - los[0];
108 else if( atmosphere_dim == 3 )
110 assert( los.
nelem() == 2 );
111 assert( los[0] >= 0 );
112 assert( los[0] <= 180 );
113 assert(
abs( los[1] ) <= 180 );
116 los[0] = 180 - los[0];
153 const Index& stokes_dim,
154 const Numeric& surface_skin_t )
156 assert( surface_rmatrix.
nrows() == stokes_dim );
157 assert( surface_rmatrix.
ncols() == stokes_dim );
158 assert( surface_emission.
nelem() == stokes_dim );
164 const Numeric rmean = ( rv + rh ) / 2;
167 surface_rmatrix = 0.0;
168 surface_emission = 0.0;
170 surface_rmatrix(0,0) = rmean;
171 surface_emission[0] = B * ( 1 - rmean );
175 const Numeric rdiff = ( rv - rh ) / 2;
177 surface_rmatrix(1,0) = rdiff;
178 surface_rmatrix(0,1) = rdiff;
179 surface_rmatrix(1,1) = rmean;
180 surface_emission[1] = -B * rdiff;
184 const Complex a = Rh * conj(Rv);
185 const Complex b = Rv * conj(Rh);
188 surface_rmatrix(2,2) = c;
192 const Numeric d = imag( a - b ) / 2.0;
194 surface_rmatrix(3,2) = d;
195 surface_rmatrix(2,3) = d;
196 surface_rmatrix(3,3) = c;
212 const Index& atmosphere_dim,
222 rte_gp_lat, rte_gp_lon );
224 out3 <<
" Result = " << outvalue <<
"\n";
231 const Index& atmosphere_dim,
241 if( rte_pos.
nelem() != atmosphere_dim )
242 throw runtime_error(
"Length of *rte_pos* must match *atmoshere_dim*." );
247 if( atmosphere_dim >= 2 )
249 if( atmosphere_dim == 3 )
253 lon,
"Incidence angle",
"Latitude",
"Longitude" );
255 out3 <<
" Result = " << outvalue <<
"\n";
264 const Index& atmosphere_dim,
282 out2 <<
" Sets r_geoid to a sphere with a constant radius of "
283 << r_local/1e3 <<
" km.\n";
286 Index nlat=1, nlon=1;
287 if( atmosphere_dim >= 2 )
288 { nlat = lat_grid.
nelem(); }
289 if( atmosphere_dim >= 3 )
290 { nlon = lon_grid.
nelem(); }
292 r_geoid.
resize( nlat, nlon );
296 out3 <<
" nrows : " << r_geoid.
nrows() <<
"\n";
297 out3 <<
" ncols : " << r_geoid.
ncols() <<
"\n";
306 const Index& atmosphere_dim,
320 const Numeric rq = 6378.138e3, rp = 6356.752e3;
321 const double rq2 = rq*rq, rp2 = rp*rp;
325 if( atmosphere_dim == 1 )
327 const Numeric azimuth_angle_1d = 0.0;
329 if( lat_grid.
nelem() != 1 )
331 "This method requires, for 1D, that *lat_grid* has length 1." );
335 out2 <<
" Sets r_geoid to the curvature radius of the WGS-84 "
336 <<
"reference ellipsiod.\n";
341 double cv = cos( lat_grid[0] *
DEG2RAD );
343 double sv = sin( lat_grid[0] *
DEG2RAD );
347 Numeric rns = rq2*rp2/pow(rq2*cv+rp2*sv,1.5);
348 Numeric rew = rq2/sqrt(rq2*cv+rp2*sv);
351 cv = cos( azimuth_angle_1d *
DEG2RAD );
352 sv = sin( azimuth_angle_1d *
DEG2RAD );
353 r_geoid(0,0) = 1/(cv*cv/rns+sv*sv/rew);
358 out2 <<
" Sets r_geoid to the radius of the WGS-84 "
359 <<
"reference ellipsiod.\n";
366 if( atmosphere_dim == 2 )
369 nlon = lon_grid.
nelem();
371 r_geoid.
resize( nlat, nlon );
374 for(
Index lat=0; lat<nlat; lat++ )
377 if( ( lat_grid[lat] < -90 ) || ( lat_grid[lat] > 90 ) )
380 os <<
"The accepted range for latitudes in this function is "
381 <<
"[-90,90],\nbut a value of " << lat_grid[lat]
383 throw runtime_error( os.str() );
387 cv = cos( lat_grid[lat] *
DEG2RAD );
388 sv = sin( lat_grid[lat] *
DEG2RAD );
391 rv = sqrt( rq2*rp2 / ( rq2*sv*sv + rp2*cv*cv ) );
394 for(
Index lon=0; lon<nlon; lon++ )
395 r_geoid(lat,lon) = rv;
398 out3 <<
" nrows : " << r_geoid.
nrows() <<
"\n";
399 out3 <<
" ncols : " << r_geoid.
ncols() <<
"\n";
409 const Index& stokes_dim,
418 out2 <<
" Sets variables to model a blackbody surface with a temperature "
419 <<
" of " << surface_skin_t <<
" K.\n";
421 surface_rmatrix.
resize(0,0,0,0);
424 surface_emission.
resize( nf, stokes_dim );
425 surface_emission = 0.0;
426 for(
Index iv=0; iv<nf; iv++ )
428 surface_emission(iv,0) =
planck( f_grid[iv], surface_skin_t );
439 const Index& stokes_dim,
440 const Index& atmosphere_dim,
443 const Vector& surface_scalar_reflectivity,
455 if( surface_scalar_reflectivity.
nelem() != nf &&
456 surface_scalar_reflectivity.
nelem() != 1 )
459 os <<
"The number of elements in *surface_scalar_reflectivity* should\n"
460 <<
"match length of *f_grid* or be 1."
461 <<
"\n length of *f_grid* : " << nf
462 <<
"\n length of *surface_scalar_reflectivity* : "
463 << surface_scalar_reflectivity.
nelem()
465 throw runtime_error( os.str() );
468 if(
min(surface_scalar_reflectivity) < 0 ||
469 max(surface_scalar_reflectivity) > 1 )
472 "All values in *surface_scalar_reflectivity* must be inside [0,1]." );
475 out2 <<
" Sets variables to model a flat surface\n";
476 out3 <<
" surface temperature: " << surface_skin_t <<
" K.\n";
479 surface_los(0,
joker) = rte_los;
482 surface_emission.
resize( nf, stokes_dim );
483 surface_rmatrix.
resize(1,nf,stokes_dim,stokes_dim);
484 surface_rmatrix = 0.0;
485 surface_emission = 0.0;
489 for(
Index iv=0; iv<nf; iv++ )
491 if( iv == 0 || surface_scalar_reflectivity.
nelem() > 1 )
492 { r = surface_scalar_reflectivity[iv]; }
494 surface_emission(iv,0) = (1.0-r) *
planck( f_grid[iv], surface_skin_t );
495 for(
Index is=0; is<stokes_dim; is++ )
496 { surface_rmatrix(0,iv,is,is) = r; }
507 const Index& stokes_dim,
508 const Index& atmosphere_dim,
525 if( complex_n.
nrows() != nf && complex_n.
nrows() != 1 )
528 os <<
"The number of rows in *complex_n* should be 1 or match the length "
530 <<
"\n length of *f_grid* : " << nf
531 <<
"\n rows in *complex_n* : " << complex_n.
nrows() <<
"\n";
532 throw runtime_error( os.str() );
535 out2 <<
" Sets variables to model a flat surface\n";
536 out3 <<
" surface temperature: " << surface_skin_t <<
" K.\n";
539 surface_los(0,
joker) = rte_los;
542 surface_emission.
resize( nf, stokes_dim );
543 surface_rmatrix.
resize( 1, nf, stokes_dim, stokes_dim );
548 for(
Index iv=0; iv<nf; iv++ )
550 if( iv == 0 || complex_n.
nrows() > 1 )
553 Complex n2( complex_n(iv,0), complex_n(iv,1) );
561 surface_emission(iv,
joker), Rv, Rh,
562 f_grid[iv], stokes_dim, surface_skin_t );
573 const Index& stokes_dim,
574 const Index& atmosphere_dim,
577 const Vector& surface_emissivity,
589 if( surface_emissivity.
nelem() != nf )
592 os <<
"The number of elements in *surface_emissivity* should match\n"
593 <<
"length of *f_grid*."
594 <<
"\n length of *f_grid* : " << nf
595 <<
"\n length of *surface_emissivity* : " << surface_emissivity.
nelem()
597 throw runtime_error( os.str() );
600 if(
min(surface_emissivity) < 0 ||
max(surface_emissivity) > 1 )
603 "All values in *surface_emissivity* must be inside [0,1]." );
606 out2 <<
" Sets variables to model a flat surface\n";
607 out3 <<
" surface temperature: " << surface_skin_t <<
" K.\n";
610 surface_los(0,
joker) = rte_los;
613 surface_emission.
resize( nf, stokes_dim );
614 surface_rmatrix.
resize(1,nf,stokes_dim,stokes_dim);
615 surface_rmatrix = 0.0;
616 surface_emission = 0.0;
618 for(
Index iv=0; iv<nf; iv++ )
620 surface_emission(iv,0) = surface_emissivity[iv] *
621 planck( f_grid[iv], surface_skin_t );
622 for(
Index is=0; is<stokes_dim; is++ )
623 { surface_rmatrix(0,iv,is,is) = 1 - surface_emissivity[iv]; }
634 const Index& stokes_dim,
635 const Index& atmosphere_dim,
638 const Numeric& surface_emissivity,
643 Vector a_vector( f_grid.
nelem(), surface_emissivity );
646 f_grid, stokes_dim, atmosphere_dim, rte_los,
647 surface_skin_t, a_vector, verbosity);
657 const Index& stokes_dim,
658 const Index& atmosphere_dim,
661 const Vector& surface_scalar_reflectivity,
673 if( surface_scalar_reflectivity.
nelem() != nf &&
674 surface_scalar_reflectivity.
nelem() != 1 )
677 os <<
"The number of elements in *surface_scalar_reflectivity* should\n"
678 <<
"match length of *f_grid* or be 1."
679 <<
"\n length of *f_grid* : " << nf
680 <<
"\n length of *surface_scalar_reflectivity* : "
681 << surface_scalar_reflectivity.
nelem()
683 throw runtime_error( os.str() );
686 if(
min(surface_scalar_reflectivity) < 0 ||
687 max(surface_scalar_reflectivity) > 1 )
690 "All values in *surface_scalar_reflectivity* must be inside [0,1]." );
696 surface_rmatrix.
resize(np,nf,stokes_dim,stokes_dim);
697 surface_emission.
resize( nf, stokes_dim );
700 surface_rmatrix = 0.0;
701 surface_emission = 0.0;
706 const Vector za_lims( 0.0, np+1, dza );
709 for(
Index ip=0; ip<np; ip++ )
710 { surface_los(ip,0) = za_lims[ip] + za_pos * dza; }
716 for(
Index iv=0; iv<nf; iv++ )
719 if( iv == 0 || surface_scalar_reflectivity.
nelem() > 1 )
720 { r = surface_scalar_reflectivity[iv]; }
723 for(
Index ip=0; ip<np; ip++ )
726 cos(2*
DEG2RAD*za_lims[ip+1]) );
727 surface_rmatrix(ip,iv,0,0) = w;
731 surface_emission(iv,0) = (1-r) *
planck( f_grid[iv], surface_skin_t );