101 const Index& atmosphere_dim,
108 if( atmosphere_dim == 1 )
114 else if( atmosphere_dim == 2 )
116 assert( gp_lat.
nelem() == n );
121 else if( atmosphere_dim == 3 )
123 assert( gp_lat.
nelem() == n );
124 assert( gp_lon.
nelem() == n );
161 const Index& atmosphere_dim,
170 if( atmosphere_dim == 1 )
172 assert( itw.
ncols() == 2 );
176 else if( atmosphere_dim == 2 )
178 assert( itw.
ncols() == 4 );
182 else if( atmosphere_dim == 3 )
184 assert( itw.
ncols() == 8 );
185 interp( x, itw, x_field, gp_p, gp_lat, gp_lon );
217 const Index& atmosphere_dim,
241 const Index& atmosphere_dim,
251 if( atmosphere_dim > 1 )
257 if( atmosphere_dim > 2 )
308 const Index& atmosphere_dim,
314 if( atmosphere_dim == 1 )
317 for (
Index i = 0; i < n; i++ )
320 gp_p_out[i].idx -= cloudbox_limits[0];
322 const Index n1 = cloudbox_limits[1] - cloudbox_limits[0];
328 else if( atmosphere_dim == 2 )
331 gp_lat_out.resize(n);
332 for (
Index i = 0; i < n; i++ )
336 gp_p_out[i].idx -= cloudbox_limits[0];
337 gp_lat_out[i].idx -= cloudbox_limits[2];
339 const Index n1 = cloudbox_limits[1] - cloudbox_limits[0];
340 const Index n2 = cloudbox_limits[3] - cloudbox_limits[2];
350 gp_lat_out.resize(n);
351 gp_lon_out.resize(n);
352 for (
Index i = 0; i < n; i++ )
357 gp_p_out[i].idx -= cloudbox_limits[0];
358 gp_lat_out[i].idx -= cloudbox_limits[2];
359 gp_lon_out[i].idx -= cloudbox_limits[4];
361 const Index n1 = cloudbox_limits[1] - cloudbox_limits[0];
362 const Index n2 = cloudbox_limits[3] - cloudbox_limits[2];
363 const Index n3 = cloudbox_limits[5] - cloudbox_limits[4];
398 const Index& atmosphere_dim,
402 if( atmosphere_dim == 1 )
408 else if( atmosphere_dim == 2 )
415 else if( atmosphere_dim == 3 )
418 assert( n == gp_lon.
nelem() );
454 const Index& atmosphere_dim,
460 if( atmosphere_dim == 1 )
462 assert( itw.
ncols() == 1 );
466 else if( atmosphere_dim == 2 )
469 assert( itw.
ncols() == 2 );
473 else if( atmosphere_dim == 3 )
476 assert( itw.
ncols() == 4 );
477 interp( x, itw, x_surface, gp_lat, gp_lon );
508 const Index& atmosphere_dim,
530 const Index& atmosphere_dim,
537 if( atmosphere_dim > 1 )
543 if( atmosphere_dim > 2 )
584 const Index& effective_dim,
602 if( dim0 != gridname )
605 os <<
"Wrong quantity found for grid of first dimension:\n"
606 <<
" expected quantity : " << dim0 <<
"\n"
607 <<
" quantity in gfield : " << gridname <<
"\n";
608 throw runtime_error( os.str() );
613 if( x < grid[0] || x >
last(grid) )
616 os <<
"Interpolation outside covered range for first dimension:\n"
617 <<
" interpolation point : " << x <<
"\n"
618 <<
" gfield grid range : [" << grid[0] <<
"," <<
last(grid)
620 throw runtime_error( os.str() );
628 if( effective_dim >= 2 )
633 if( dim1 != gridname )
636 os <<
"Wrong quantity found for grid of second dimension:\n"
637 <<
" expected quantity : " << dim1 <<
"\n"
638 <<
" quantity in gfield : " << gridname <<
"\n";
639 throw runtime_error( os.str() );
644 if( y < grid[0] || y >
last(grid) )
647 os <<
"Interpolation outside covered range for second dimension:\n"
648 <<
" interpolation point : " << y <<
"\n"
649 <<
" gfield grid range : [" << grid[0] <<
"," <<
last(grid)
651 throw runtime_error( os.str() );
659 if( effective_dim >= 3 )
664 if( dim2 != gridname )
667 os <<
"Wrong quantity found for grid of third dimension:\n"
668 <<
" expected quantity : " << dim2 <<
"\n"
669 <<
" quantity in gfield : " << gridname <<
"\n";
670 throw runtime_error( os.str() );
675 if( z < grid[0] || z >
last(grid) )
678 os <<
"Interpolation outside covered range for second dimension:\n"
679 <<
" interpolation point : " << z <<
"\n"
680 <<
" gfield grid range : [" << grid[0] <<
"," <<
last(grid)
682 throw runtime_error( os.str() );
692 if( effective_dim == 1 )
697 os <<
"A 1D interpolation requested, but the provided gridded field "
698 <<
"has an effective dimension of 2D or 3D.";
699 throw runtime_error( os.str() );
707 else if( effective_dim == 2 )
712 os <<
"A 2D interpolation requested, but the provided gridded field "
713 <<
"has an effective dimension of 3D.";
714 throw runtime_error( os.str() );
722 else if( effective_dim == 3 )
726 interp( result, itw, gfield3.
data, gp0, gp1, gp2 );
769 assert( itw.
ncols() == 2 );
777 interp( p_values, itw, logpgrid, gp );
822 gridpos( gp, logold, lognew, extpolfac );
896 assert( z.
nelem() == np );
897 assert( z_field.nrows() == np );
898 assert( z_field.ncols() == lat_grid.nelem() );
905 gridpos( gp_z, p_grid, p_grid );
907 interp( z_matrix, itw, z_field, gp_z, agp_lat );
951 assert( z.
nelem() == np );
952 assert( z_field.npages() == np );
953 assert( z_field.nrows() == lat_grid.nelem() );
954 assert( z_field.ncols() == lon_grid.
nelem() );
962 gridpos( agp_z, p_grid, p_grid );
965 interp( z_tensor, itw, z_field, agp_z, agp_lat, agp_lon );