src/interpolation.h

Go to the documentation of this file.
00001 /*
00002  * Fimex
00003  * 
00004  * (C) Copyright 2008, met.no
00005  *
00006  * Project Info:  https://wiki.met.no/fimex/start
00007  *
00008  * This library is free software; you can redistribute it and/or modify it
00009  * under the terms of the GNU Lesser General Public License as published by
00010  * the Free Software Foundation; either version 2.1 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00015  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00016  * License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
00021  * USA.
00022  */
00023 
00024 #ifndef INTERPOLATION_H_
00025 #define INTERPOLATION_H_
00026 
00027 #include <proj_api.h>
00028 #include <math.h>
00029 
00030 #ifdef __cplusplus
00031 extern "C" {
00032 #endif
00033 
00034         
00040 #define MIFI_NEAREST_NEIGHBOR 0
00041 
00046 #define MIFI_BILINEAR         1
00047 
00053 #define MIFI_BICUBIC          2
00054 
00055         
00061 #define MIFI_VECTOR_KEEP_SIZE 0
00062 
00067 #define MIFI_VECTOR_RESIZE    1
00068         
00069         
00071 #define MIFI_UNDEFINED_F (nanf(""))
00072 
00073 #define MIFI_UNDEFINED_D (nan(""))
00074 
00076 #define MIFI_ERROR -1
00077 
00078 #define MIFI_OK 1
00079 
00081 #define MIFI_PROJ_AXIS 0
00082 
00083 #define MIFI_LONGITUDE 1
00084 
00085 #define MIFI_LATITUDE 2
00086 
00088 #define MIFI_DEBUG 0
00089 
00114 extern int mifi_interpolate_f(int method,
00115                         const char* proj_input, const float* infield, const double* in_x_axis, const double* in_y_axis, 
00116                         const int in_x_axis_type, const int in_y_axis_type, const int ix, const int iy, const int iz,
00117                         const char* proj_output, float* outfield, const double* out_x_axis, const double* out_y_axis, 
00118                         const int out_x_axis_type, const int out_y_axis_type, const int ox, const int oy);
00119 
00126 extern int mifi_interpolate_d(int method,
00127                         char* proj_input, double* infield, double* in_x_axis, double* in_y_axis, 
00128                         int in_x_axis_type, int in_y_axis_type, int ix, int iy, int iz,
00129                         char* proj_output, double* outfield, double* out_x_axis, double* out_y_axis, 
00130                         int out_x_axis_type, int out_y_axis_type, int ox, int oy);
00131 
00167 extern int mifi_vector_reproject_values_f(int method,
00168                                                 const char* proj_input, 
00169                                                 const char* proj_output,
00170                                                 float* u_out, float* v_out,
00171                                                 const double* out_x_axis, const double* out_y_axis,
00172                                                 int out_x_axis_type, int out_y_axis_type,
00173                                                 int ox, int oy, int oz);
00186 extern int mifi_vector_reproject_values_by_matrix_f(int method,
00187                                                 const double* matrix,
00188                                                 float* u_out, float* v_out,
00189                                                 int ox, int oy, int oz);
00190 
00206 extern int mifi_get_vector_reproject_matrix(const char* proj_input, 
00207                                                 const char* proj_output,
00208                                                 const double* out_x_axis, const double* out_y_axis,
00209                                                 int out_x_axis_type, int out_y_axis_type,
00210                                                 int ox, int oy,
00211                                                 double* matrix);
00212 
00213 
00218 extern int mifi_get_values_f(const float* infield, float* outfield, const double x, const double y, const int ix, const int iy, const int iz);
00219 
00241 extern int mifi_get_values_bilinear_f(const float* infield, float* outvalues, const double x, const double y, const int ix, const int iy, const int iz);
00242 
00243 
00249 extern int mifi_get_values_bicubic_f(const float* infield, float* outvalues, const double x, const double y, const int ix, const int iy, const int iz);                        
00250                         
00251               
00263 extern int mifi_points2position(double* points, const int n, const double* axis, const int num, const int axis_type); 
00264        
00265        
00271 inline int mifi_3d_array_position(int x, int y, int z, int ix, int iy, int iz) {
00272         return (z*iy + y)*ix + x;
00273 }
00274 
00291 extern int mifi_project_axes(const char* proj_input, const char* proj_output, const double* in_x_axis, const double* in_y_axis, const int ix, const int iy, double* out_xproj_axis, double* out_yproj_axis);
00292 
00303 extern size_t mifi_bad2nanf(float* posPtr, float* endPtr, float badVal);
00312 extern size_t mifi_nanf2bad(float* posPtr, float* endPtr, float badVal);
00313 
00314 #ifdef __cplusplus
00315 }
00316 #endif
00317 
00318 
00319 #endif /*INTERPOLATION_H_*/

Generated on Thu Jun 5 14:58:22 2008 for MI - Fimex by  doxygen 1.4.6