ARTS  2.4.0(git:4fb77825)
special_interp.h
Go to the documentation of this file.
1 /* Copyright (C) 2002-2012 Patrick Eriksson <Patrick.Eriksson@chalmers.se>
2 
3  This program is free software; you can redistribute it and/or modify it
4  under the terms of the GNU General Public License as published by the
5  Free Software Foundation; either version 2, or (at your option) any
6  later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16  USA. */
17 
26 #ifndef special_interp_h
27 #define special_interp_h
28 
29 #include "gridded_fields.h"
30 #include "interpolation.h"
31 #include "interpolation_poly.h"
32 #include "jacobian.h"
33 
34 /*===========================================================================
35  === Interpolation functions for atmospheric grids, fields and surfaces
36  ===========================================================================*/
37 
59  const Index& atmosphere_dim,
60  const ArrayOfGridPos& gp_p,
61  const ArrayOfGridPos& gp_lat,
62  const ArrayOfGridPos& gp_lon);
63 
90  const Index& atmosphere_dim,
91  ConstTensor3View x_field,
92  const ArrayOfGridPos& gp_p,
93  const ArrayOfGridPos& gp_lat,
94  const ArrayOfGridPos& gp_lon,
95  ConstMatrixView itw);
96 
122  const Index& atmosphere_dim,
123  ConstTensor3View x_field,
124  const ArrayOfGridPos& gp_p,
125  const ArrayOfGridPos& gp_lat,
126  const ArrayOfGridPos& gp_lon);
127 
154  ConstTensor3View x_field,
155  const GridPos& gp_p = {0, {0, 1}},
156  const GridPos& gp_lat = {0, {0, 1}},
157  const GridPos& gp_lon = {0, {0, 1}});
158 
187  GridPos& gp_p_out,
188  GridPos& gp_lat_out,
189  GridPos& gp_lon_out,
190  const GridPos& gp_p_in,
191  const GridPos& gp_lat_in,
192  const GridPos& gp_lon_in,
193  const Index& atmosphere_dim,
195 
216  const Index& atmosphere_dim,
217  const ArrayOfGridPos& gp_lat,
218  const ArrayOfGridPos& gp_lon);
219 
245  const Index& atmosphere_dim,
246  ConstMatrixView x_surface,
247  const ArrayOfGridPos& gp_lat,
248  const ArrayOfGridPos& gp_lon,
249  ConstMatrixView itw);
250 
275  const Index& atmosphere_dim,
276  ConstMatrixView x_field,
277  const ArrayOfGridPos& gp_lat,
278  const ArrayOfGridPos& gp_lon);
279 
305  ConstMatrixView x_field,
306  const GridPos& gp_lat,
307  const GridPos& gp_lon);
308 
324 void regrid_atmfield_by_gp(Tensor3& field_new,
325  const Index& atmosphere_dim,
326  ConstTensor3View field_old,
327  const ArrayOfGridPos& gp_p,
328  const ArrayOfGridPos& gp_lat,
329  const ArrayOfGridPos& gp_lon);
330 
345 void regrid_atmsurf_by_gp(Matrix& field_new,
346  const Index& atmosphere_dim,
347  ConstMatrixView field_old,
348  const ArrayOfGridPos& gp_lat,
349  const ArrayOfGridPos& gp_lon);
350 
372  ArrayOfGridPos& gp_lat,
373  ArrayOfGridPos& gp_lon,
374  const RetrievalQuantity& rq,
375  const Index& atmosphere_dim,
376  const Vector& p_grid,
377  const Vector& lat_grid,
378  const Vector& lon_grid);
379 
399  ArrayOfGridPos& gp_lon,
400  const RetrievalQuantity& rq,
401  const Index& atmosphere_dim,
402  const Vector& lat_grid,
403  const Vector& lon_grid);
404 
405 
434  ArrayOfGridPos& gp_lat,
435  ArrayOfGridPos& gp_lon,
436  Index& n_p,
437  Index& n_lat,
438  Index& n_lon,
439  const ArrayOfVector& ret_grids,
440  const Index& atmosphere_dim,
441  const Vector& p_grid,
442  const Vector& lat_grid,
443  const Vector& lon_grid);
444 
470  ArrayOfGridPos& gp_lon,
471  Index& n_lat,
472  Index& n_lon,
473  const ArrayOfVector& ret_grids,
474  const Index& atmosphere_dim,
475  const Vector& lat_grid,
476  const Vector& lon_grid);
477 
478 
494 void regrid_atmfield_by_gp_oem(Tensor3& field_new,
495  const Index& atmosphere_dim,
496  ConstTensor3View field_old,
497  const ArrayOfGridPos& gp_p,
498  const ArrayOfGridPos& gp_lat,
499  const ArrayOfGridPos& gp_lon);
500 
515 void regrid_atmsurf_by_gp_oem(Matrix& field_new,
516  const Index& atmosphere_dim,
517  ConstMatrixView field_old,
518  const ArrayOfGridPos& gp_lat,
519  const ArrayOfGridPos& gp_lon);
520 
541 void itw2p(VectorView p_values,
543  const ArrayOfGridPos& gp,
544  ConstMatrixView itw);
545 
570 void p2gridpos(ArrayOfGridPos& gp,
571  ConstVectorView old_pgrid,
572  ConstVectorView new_pgrid,
573  const Numeric& extpolfac = 0.5);
574 
594  ConstVectorView old_pgrid,
595  ConstVectorView new_pgrid,
596  const Index order,
597  const Numeric& extpolfac = 0.5);
598 
624 void rte_pos2gridpos(GridPos& gp_p,
625  GridPos& gp_lat,
626  GridPos& gp_lon,
627  const Index& atmosphere_dim,
633 
652 void rte_pos2gridpos(GridPos& gp_lat,
653  GridPos& gp_lon,
654  const Index& atmosphere_dim,
658 
675 void z_at_lat_2d(VectorView z,
679  const GridPos& gp_lat);
680 
699 void z_at_latlon(VectorView z,
704  const GridPos& gp_lat,
705  const GridPos& gp_lon);
706 
721 void complex_n_interp(MatrixView n_real,
722  MatrixView n_imag,
723  const GriddedField3& complex_n,
724  const String& varname,
726  ConstVectorView t_grid);
727 
728 #endif // special_interp_h
Matrix
The Matrix class.
Definition: matpackI.h:1193
ARTS::Var::atmosphere_dim
Index atmosphere_dim(Workspace &ws) noexcept
Definition: autoarts.h:2510
gridded_fields.h
Implementation of gridded fields.
ARTS::Var::z_field
Tensor3 z_field(Workspace &ws) noexcept
Definition: autoarts.h:7690
get_gp_rq_to_atmgrids
void get_gp_rq_to_atmgrids(ArrayOfGridPos &gp_p, ArrayOfGridPos &gp_lat, ArrayOfGridPos &gp_lon, Index &n_p, Index &n_lat, Index &n_lon, const ArrayOfVector &ret_grids, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid)
Determines grid positions for regridding of atmospheric fields to retrieval grids.
Definition: special_interp.cc:413
MatrixView
The MatrixView class.
Definition: matpackI.h:1093
interp_atmsurface_by_gp
void interp_atmsurface_by_gp(VectorView x, const Index &atmosphere_dim, ConstMatrixView x_field, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Interpolates a surface-type variable given the grid positions.
Definition: special_interp.cc:271
Tensor3
The Tensor3 class.
Definition: matpackIII.h:339
regrid_atmfield_by_gp
void regrid_atmfield_by_gp(Tensor3 &field_new, const Index &atmosphere_dim, ConstTensor3View field_old, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Regrids an atmospheric field, for precalculated grid positions.
Definition: special_interp.cc:310
ARTS::Var::lat_grid
Vector lat_grid(Workspace &ws) noexcept
Definition: autoarts.h:3962
interpolation.h
Header file for interpolation.cc.
itw2p
void itw2p(VectorView p_values, ConstVectorView p_grid, const ArrayOfGridPos &gp, ConstMatrixView itw)
Converts interpolation weights to pressures.
Definition: special_interp.cc:718
p2gridpos
void p2gridpos(ArrayOfGridPos &gp, ConstVectorView old_pgrid, ConstVectorView new_pgrid, const Numeric &extpolfac=0.5)
Calculates grid positions for pressure values.
Definition: special_interp.cc:759
regrid_atmfield_by_gp_oem
void regrid_atmfield_by_gp_oem(Tensor3 &field_new, const Index &atmosphere_dim, ConstTensor3View field_old, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Regridding of atmospheric field OEM-type.
Definition: special_interp.cc:507
ARTS::Var::cloudbox_limits
ArrayOfIndex cloudbox_limits(Workspace &ws) noexcept
Definition: autoarts.h:2762
interp_atmfield_gp2itw
void interp_atmfield_gp2itw(Matrix &itw, const Index &atmosphere_dim, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Converts atmospheric grid positions to weights for interpolation of an atmospheric field.
Definition: special_interp.cc:75
regrid_atmsurf_by_gp
void regrid_atmsurf_by_gp(Matrix &field_new, const Index &atmosphere_dim, ConstMatrixView field_old, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Regrids an atmospheric surface, for precalculated grid positions.
Definition: special_interp.cc:343
complex_n_interp
void complex_n_interp(MatrixView n_real, MatrixView n_imag, const GriddedField3 &complex_n, const String &varname, ConstVectorView f_grid, ConstVectorView t_grid)
General function for interpolating data of complex n type.
Definition: special_interp.cc:926
GriddedField3
Definition: gridded_fields.h:284
Array
This can be used to make arrays out of anything.
Definition: array.h:108
ARTS::Var::rte_pos
Vector rte_pos(Workspace &ws) noexcept
Definition: autoarts.h:5672
z_at_latlon
void z_at_latlon(VectorView z, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View z_field, const GridPos &gp_lat, const GridPos &gp_lon)
Returns the geomtrical altitudes of p_grid for one latitude and one longitude.
Definition: special_interp.cc:888
my_basic_string< char >
VectorView
The VectorView class.
Definition: matpackI.h:610
ARTS::Var::p_grid
Vector p_grid(Workspace &ws) noexcept
Definition: autoarts.h:4763
interp_cloudfield_gp2itw
void interp_cloudfield_gp2itw(VectorView itw, GridPos &gp_p_out, GridPos &gp_lat_out, GridPos &gp_lon_out, const GridPos &gp_p_in, const GridPos &gp_lat_in, const GridPos &gp_lon_in, const Index &atmosphere_dim, const ArrayOfIndex &cloudbox_limits)
Converts atmospheric a grid position to weights for interpolation of a field defined ONLY inside the ...
Definition: special_interp.cc:165
jacobian.h
Routines for setting up the jacobian.
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
rte_pos2gridpos
void rte_pos2gridpos(GridPos &gp_p, GridPos &gp_lat, GridPos &gp_lon, const Index &atmosphere_dim, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View z_field, ConstVectorView rte_pos)
Converts a geographical position (rte_pos) to grid positions for p, lat and lon.
Definition: special_interp.cc:788
ARTS::Var::f_grid
Vector f_grid(Workspace &ws) noexcept
Definition: autoarts.h:3449
interpolation_poly.h
Header file for interpolation_poly.cc.
ARTS::Var::lon_grid
Vector lon_grid(Workspace &ws) noexcept
Definition: autoarts.h:4090
ConstMatrixView
A constant view of a Matrix.
Definition: matpackI.h:982
get_gp_atmsurf_to_rq
void get_gp_atmsurf_to_rq(ArrayOfGridPos &gp_lat, ArrayOfGridPos &gp_lon, const RetrievalQuantity &rq, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid)
Determines grid positions for regridding of atmospheric surfaces to retrieval grids.
Definition: special_interp.cc:392
GridPos
Structure to store a grid position.
Definition: interpolation.h:73
interp_atmfield_by_gp
void interp_atmfield_by_gp(VectorView x, const Index &atmosphere_dim, ConstTensor3View x_field, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Interpolates an atmospheric field given the grid positions.
Definition: special_interp.cc:126
ConstTensor3View
A constant view of a Tensor3.
Definition: matpackIII.h:132
regrid_atmsurf_by_gp_oem
void regrid_atmsurf_by_gp_oem(Matrix &field_new, const Index &atmosphere_dim, ConstMatrixView field_old, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Regridding of surface field OEM-type.
Definition: special_interp.cc:658
interp_atmsurface_by_itw
void interp_atmsurface_by_itw(VectorView x, const Index &atmosphere_dim, ConstMatrixView x_surface, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon, ConstMatrixView itw)
Interpolates a surface-type variable with pre-calculated weights by interp_atmsurface_gp2itw.
Definition: special_interp.cc:247
z_at_lat_2d
void z_at_lat_2d(VectorView z, ConstVectorView p_grid, ConstVectorView lat_grid, ConstMatrixView z_field, const GridPos &gp_lat)
Returns the geomtrical altitudes of p_grid for one latitude.
Definition: special_interp.cc:860
ARTS::Var::x
Vector x(Workspace &ws) noexcept
Definition: autoarts.h:7346
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
RetrievalQuantity
Deals with internal derivatives, Jacobian definition, and OEM calculations.
Definition: jacobian.h:120
Vector
The Vector class.
Definition: matpackI.h:860
get_gp_atmgrids_to_rq
void get_gp_atmgrids_to_rq(ArrayOfGridPos &gp_p, ArrayOfGridPos &gp_lat, ArrayOfGridPos &gp_lon, const RetrievalQuantity &rq, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid)
Determines grid positions for regridding of atmospheric fields to retrieval grids.
Definition: special_interp.cc:366
interp_atmsurface_gp2itw
void interp_atmsurface_gp2itw(Matrix &itw, const Index &atmosphere_dim, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon)
Converts atmospheric grid positions to weights for interpolation of a surface-type variable.
Definition: special_interp.cc:224
ConstVectorView
A constant view of a Vector.
Definition: matpackI.h:476
p2gridpos_poly
void p2gridpos_poly(ArrayOfGridPosPoly &gp, ConstVectorView old_pgrid, ConstVectorView new_pgrid, const Index order, const Numeric &extpolfac=0.5)
p2gridpos_poly
Definition: special_interp.cc:773
interp_atmfield_by_itw
void interp_atmfield_by_itw(VectorView x, const Index &atmosphere_dim, ConstTensor3View x_field, const ArrayOfGridPos &gp_p, const ArrayOfGridPos &gp_lat, const ArrayOfGridPos &gp_lon, ConstMatrixView itw)
Interpolates an atmospheric field with pre-calculated weights by interp_atmfield_gp2itw.
Definition: special_interp.cc:101