# MI - Fimex: include/fimex/interpolation.h Source File

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

# include/fimex/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 <math.h>
    00028 #include <string.h>
    00029
    00030 // M_PI no longer in c99
    00031 #define PI 3.1415926535897932384626433832795
    00032
    00033 #ifdef __cplusplus
    00034 extern "C" {
    00035 #endif
    00036
    00037
    00043 #define MIFI_INTERPOL_NEAREST_NEIGHBOR 0
    00044
    00049 #define MIFI_INTERPOL_BILINEAR         1
    00050
    00055 #define MIFI_INTERPOL_BICUBIC          2
    00056
    00068 #define MIFI_INTERPOL_COORD_NN         3
    00069
    00086 #define MIFI_INTERPOL_COORD_NN_KD      4
    00087
    00093 #define MIFI_INTERPOL_FORWARD_SUM      5
    00094
    00100 #define MIFI_INTERPOL_FORWARD_MEAN      6
    00101
    00107 #define MIFI_INTERPOL_FORWARD_MEDIAN      7
    00108
    00109
    00115 #define MIFI_INTERPOL_FORWARD_MAX      8
    00116
    00122 #define MIFI_INTERPOL_FORWARD_MIN      9
    00123
    00129 #define MIFI_VECTOR_KEEP_SIZE 0
    00130
    00135 #define MIFI_VECTOR_RESIZE    1
    00136
    00137
    00139 #define MIFI_UNDEFINED_F (nanf(""))
    00140
    00141 #define MIFI_UNDEFINED_D (nan(""))
    00142
    00144 #define MIFI_ERROR -1
    00145
    00146 #define MIFI_OK 1
    00147
    00149 #define MIFI_PROJ_AXIS 0
    00150
    00151 #define MIFI_LONGITUDE 1
    00152
    00153 #define MIFI_LATITUDE 2
    00154
    00156 #define MIFI_DEBUG 0
    00157
    00182 extern int mifi_interpolate_f(int method,
    00183                         const char* proj_input, const float* infield, const double* in_x_axis, const double* in_y_axis,
    00184                         const int in_x_axis_type, const int in_y_axis_type, const int ix, const int iy, const int iz,
    00185                         const char* proj_output, float* outfield, const double* out_x_axis, const double* out_y_axis,
    00186                         const int out_x_axis_type, const int out_y_axis_type, const int ox, const int oy);
    00187
    00194 extern int mifi_interpolate_d(int method,
    00195                         char* proj_input, double* infield, double* in_x_axis, double* in_y_axis,
    00196                         int in_x_axis_type, int in_y_axis_type, int ix, int iy, int iz,
    00197                         char* proj_output, double* outfield, double* out_x_axis, double* out_y_axis,
    00198                         int out_x_axis_type, int out_y_axis_type, int ox, int oy);
    00199
    00235 extern int mifi_vector_reproject_values_f(int method,
    00236                                                 const char* proj_input,
    00237                                                 const char* proj_output,
    00238                                                 float* u_out, float* v_out,
    00239                                                 const double* out_x_axis, const double* out_y_axis,
    00240                                                 int out_x_axis_type, int out_y_axis_type,
    00241                                                 int ox, int oy, int oz);
    00253 extern int mifi_vector_reproject_values_by_matrix_f(int method,
    00254                                                 const double* matrix,
    00255                                                 float* u_out, float* v_out,
    00256                                                 int ox, int oy, int oz);
    00257
    00273 extern int mifi_get_vector_reproject_matrix(const char* proj_input,
    00274                                                 const char* proj_output,
    00275                                                 const double* out_x_axis, const double* out_y_axis,
    00276                                                 int out_x_axis_type, int out_y_axis_type,
    00277                                                 int ox, int oy,
    00278                                                 double* matrix);
    00279
    00280
    00287 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);
    00288
    00310 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);
    00311
    00312
    00327 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);
    00328
    00343 extern void mifi_get_values_linear_f(const float* infieldA, const float* infieldB, float* outfield, const size_t n, const double a, const double b, const double x);
    00344
    00345
    00357 extern int mifi_points2position(double* points, const int n, const double* axis, const int num, const int axis_type);
    00358
    00359
    00365 extern int mifi_3d_array_position(int x, int y, int z, int ix, int iy, int iz);
    00366
    00367
    00381 int mifi_project_values(const char* proj_input, const char* proj_output, double* in_out_x_vals, double* in_out_y_vals, const int num);
    00382
    00399 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);
    00400
    00411 extern size_t mifi_bad2nanf(float* posPtr, float* endPtr, float badVal);
    00420 extern size_t mifi_nanf2bad(float* posPtr, float* endPtr, float badVal);
    00421
    00422 #ifdef __cplusplus
    00423 }
    00424 #endif
    00425
    00426
    00427 #endif /*INTERPOLATION_H_*/