FV3 Bundle
create_xgrid.h
Go to the documentation of this file.
1 /***********************************************************************
2  * GNU Lesser General Public License
3  *
4  * This file is part of the GFDL Flexible Modeling System (FMS).
5  *
6  * FMS is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or (at
9  * your option) any later version.
10  *
11  * FMS is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14  * for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FMS. If not, see <http://www.gnu.org/licenses/>.
18  **********************************************************************/
19 #ifndef CREATE_XGRID_H_
20 #define CREATE_XGRID_H_
21 
22 #ifndef MAXXGRID
23 #define MAXXGRID 1e6
24 #endif
25 
26 #define MV 50
27 /* this value is small compare to earth area */
28 
29 double grid_box_radius(const double *x, const double *y, const double *z, int n);
30 
31 double dist_between_boxes(const double *x1, const double *y1, const double *z1, int n1,
32  const double *x2, const double *y2, const double *z2, int n2);
33 
34 int inside_edge(double x0, double y0, double x1, double y1, double x, double y);
35 
36 int line_intersect_2D_3D(double *a1, double *a2, double *q1, double *q2, double *q3,
37  double *intersect, double *u_a, double *u_q, int *inbound);
38 
39 double poly_ctrlon(const double lon[], const double lat[], int n, double clon);
40 
41 double poly_ctrlat(const double lon[], const double lat[], int n);
42 
43 double box_ctrlon(double ll_lon, double ll_lat, double ur_lon, double ur_lat, double clon);
44 
45 double box_ctrlat(double ll_lon, double ll_lat, double ur_lon, double ur_lat);
46 
47 int get_maxxgrid(void);
48 
49 int get_maxxgrid_(void);
50 
51 void get_grid_area(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area);
52 
53 void get_grid_great_circle_area(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area);
54 
55 void get_grid_area_dimensionless(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area);
56 
57 void get_grid_area_no_adjust(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area);
58 
59 int clip(const double lon_in[], const double lat_in[], int n_in, double ll_lon, double ll_lat,
60  double ur_lon, double ur_lat, double lon_out[], double lat_out[]);
61 
62 int clip_2dx2d(const double lon1_in[], const double lat1_in[], int n1_in,
63  const double lon2_in[], const double lat2_in[], int n2_in,
64  double lon_out[], double lat_out[]);
65 
66 int create_xgrid_1dx2d_order1(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in,
67  const double *lat_in, const double *lon_out, const double *lat_out,
68  const double *mask_in, int *i_in, int *j_in, int *i_out,
69  int *j_out, double *xgrid_area);
70 
71 int create_xgrid_1dx2d_order1_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
72  const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
73  const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out, double *xgrid_area);
74 
75 int create_xgrid_1dx2d_order2(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
76  const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
77  const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out,
78  double *xgrid_area, double *xgrid_clon, double *xgrid_clat);
79 
80 int create_xgrid_1dx2d_order2_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
81  const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
82  const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out,
83  double *xgrid_area, double *xgrid_clon, double *xgrid_clat);
84 
85 int create_xgrid_2dx1d_order1(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in,
86  const double *lat_in, const double *lon_out, const double *lat_out,
87  const double *mask_in, int *i_in, int *j_in, int *i_out,
88  int *j_out, double *xgrid_area);
89 
90 int create_xgrid_2dx1d_order1_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
91  const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
92  const double *mask_in, int *i_in, int *j_in, int *i_out,
93  int *j_out, double *xgrid_area);
94 
95 int create_xgrid_2dx1d_order2(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
96  const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
97  const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out,
98  double *xgrid_area, double *xgrid_clon, double *xgrid_clat);
99 
100 int create_xgrid_2dx1d_order2_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
101  const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
102  const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out,
103  double *xgrid_area, double *xgrid_clon, double *xgrid_clat);
104 
105 int create_xgrid_2dx2d_order1(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
106  const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
107  const double *mask_in, int *i_in, int *j_in, int *i_out,
108  int *j_out, double *xgrid_area);
109 
110 int create_xgrid_2dx2d_order2(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
111  const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
112  const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out,
113  double *xgrid_area, double *xgrid_clon, double *xgrid_clat);
114 
115 int clip_2dx2d_great_circle(const double x1_in[], const double y1_in[], const double z1_in[], int n1_in,
116  const double x2_in[], const double y2_in[], const double z2_in [], int n2_in,
117  double x_out[], double y_out[], double z_out[]);
118 
119 int create_xgrid_great_circle(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
120  const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
121  const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out,
122  double *xgrid_area, double *xgrid_clon, double *xgrid_clat);
123 
124 void get_grid_area_ug(const int *npts, const double *lon, const double *lat, double *area);
125 int create_xgrid_1dx2d_order1_ug(const int *nlon_in, const int *nlat_in, const int *npts_out, const double *lon_in,
126  const double *lat_in, const double *lon_out, const double *lat_out,
127  const double *mask_in, int *i_in, int *j_in, int *l_out, double *xgrid_area);
128 void get_grid_great_circle_area_ug(const int *npts, const double *lon, const double *lat, double *area);
129 int create_xgrid_great_circle_ug(const int *nlon_in, const int *nlat_in, const int *npts_out,
130  const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
131  const double *mask_in, int *i_in, int *j_in, int *l_out,
132  double *xgrid_area, double *xgrid_clon, double *xgrid_clat);
133 
134 #ifndef __AIX
135 void get_grid_area_(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area);
136 
137 void get_grid_great_circle_area_(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area);
138 
139 int create_xgrid_2dx2d_order1_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
140  const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
141  const double *mask_in, int *i_in, int *j_in, int *i_out,
142  int *j_out, double *xgrid_area);
143 
144 int create_xgrid_2dx2d_order2_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out,
145  const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
146  const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out,
147  double *xgrid_area, double *xgrid_clon, double *xgrid_clat);
148 void get_grid_area_ug_(const int *npts, const double *lon, const double *lat, double *area);
149 int create_xgrid_1dx2d_order1_ug_(const int *nlon_in, const int *nlat_in, const int *npts_out, const double *lon_in,
150  const double *lat_in, const double *lon_out, const double *lat_out,
151  const double *mask_in, int *i_in, int *j_in, int *l_out, double *xgrid_area);
152 void get_grid_great_circle_area_ug_(const int *npts, const double *lon, const double *lat, double *area);
153 int create_xgrid_great_circle_ug_(const int *nlon_in, const int *nlat_in, const int *npts_out,
154  const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out,
155  const double *mask_in, int *i_in, int *j_in, int *l_out,
156  double *xgrid_area, double *xgrid_clon, double *xgrid_clat);
157 
158 #endif
159 
160 #endif
real, parameter a1
int create_xgrid_2dx1d_order1_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out, double *xgrid_area)
Definition: create_xgrid.c:579
int inbound
Definition: mosaic_util.h:39
double box_ctrlat(double ll_lon, double ll_lat, double ur_lon, double ur_lat)
void get_grid_great_circle_area_(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area)
Definition: create_xgrid.c:125
void get_grid_great_circle_area_ug_(const int *npts, const double *lon, const double *lat, double *area)
Definition: create_xgrid.c:174
double box_ctrlon(double ll_lon, double ll_lat, double ur_lon, double ur_lat, double clon)
int clip(const double lon_in[], const double lat_in[], int n_in, double ll_lon, double ll_lat, double ur_lon, double ur_lat, double lon_out[], double lat_out[])
int create_xgrid_2dx2d_order1_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out, double *xgrid_area)
Definition: create_xgrid.c:788
int inside_edge(double x0, double y0, double x1, double y1, double x, double y)
real function intersect(x1, y1, x2, y2, x)
real(fvprc), dimension(:), allocatable lon
int create_xgrid_1dx2d_order1_ug(const int *nlon_in, const int *nlat_in, const int *npts_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *l_out, double *xgrid_area)
Definition: create_xgrid.c:391
double y
Definition: mosaic_util.h:37
double dist_between_boxes(const double *x1, const double *y1, const double *z1, int n1, const double *x2, const double *y2, const double *z2, int n2)
int clip_2dx2d_great_circle(const double x1_in[], const double y1_in[], const double z1_in[], int n1_in, const double x2_in[], const double y2_in[], const double z2_in [], int n2_in, double x_out[], double y_out[], double z_out[])
int create_xgrid_1dx2d_order1(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out, double *xgrid_area)
Definition: create_xgrid.c:287
int clip_2dx2d(const double lon1_in[], const double lat1_in[], int n1_in, const double lon2_in[], const double lat2_in[], int n2_in, double lon_out[], double lat_out[])
int line_intersect_2D_3D(double *a1, double *a2, double *q1, double *q2, double *q3, double *intersect, double *u_a, double *u_q, int *inbound)
real, dimension(1, 1) lon_out
void get_grid_area_ug(const int *npts, const double *lon, const double *lat, double *area)
Definition: create_xgrid.c:100
int create_xgrid_great_circle_ug_(const int *nlon_in, const int *nlat_in, const int *npts_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *l_out, double *xgrid_area, double *xgrid_clon, double *xgrid_clat)
void get_grid_area_ug_(const int *npts, const double *lon, const double *lat, double *area)
Definition: create_xgrid.c:94
integer nlon
No description.
real, dimension(1, 1) lat_out
double z
Definition: mosaic_util.h:37
real, dimension(:,:), allocatable area
int get_maxxgrid(void)
Definition: create_xgrid.c:42
int create_xgrid_1dx2d_order2_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out, double *xgrid_area, double *xgrid_clon, double *xgrid_clat)
Definition: create_xgrid.c:479
int create_xgrid_2dx1d_order1(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out, double *xgrid_area)
Definition: create_xgrid.c:591
real, parameter a2
double poly_ctrlat(const double lon[], const double lat[], int n)
double grid_box_radius(const double *x, const double *y, const double *z, int n)
int create_xgrid_great_circle_ug(const int *nlon_in, const int *nlat_in, const int *npts_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *l_out, double *xgrid_area, double *xgrid_clon, double *xgrid_clat)
int create_xgrid_2dx1d_order2_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out, double *xgrid_area, double *xgrid_clon, double *xgrid_clat)
Definition: create_xgrid.c:681
real(fvprc), dimension(:), allocatable lat
double poly_ctrlon(const double lon[], const double lat[], int n, double clon)
type(gsw_result_mpres) n2
integer, parameter, public npts
int create_xgrid_1dx2d_order2(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out, double *xgrid_area, double *xgrid_clon, double *xgrid_clat)
Definition: create_xgrid.c:490
int create_xgrid_2dx2d_order1(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out, double *xgrid_area)
Definition: create_xgrid.c:801
int create_xgrid_2dx2d_order2_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out, double *xgrid_area, double *xgrid_clon, double *xgrid_clat)
void get_grid_area_dimensionless(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area)
Definition: create_xgrid.c:219
void get_grid_great_circle_area_ug(const int *npts, const double *lon, const double *lat, double *area)
Definition: create_xgrid.c:181
int create_xgrid_great_circle(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out, double *xgrid_area, double *xgrid_clon, double *xgrid_clat)
int create_xgrid_2dx2d_order2(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out, double *xgrid_area, double *xgrid_clon, double *xgrid_clat)
void get_grid_great_circle_area(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area)
Definition: create_xgrid.c:132
double x
Definition: mosaic_util.h:37
void get_grid_area_(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area)
Definition: create_xgrid.c:58
int create_xgrid_1dx2d_order1_(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out, double *xgrid_area)
Definition: create_xgrid.c:275
int get_maxxgrid_(void)
Definition: create_xgrid.c:47
void get_grid_area_no_adjust(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area)
Definition: create_xgrid.c:245
integer nlat
No description.
void get_grid_area(const int *nlon, const int *nlat, const double *lon, const double *lat, double *area)
Definition: create_xgrid.c:64
int create_xgrid_2dx1d_order2(const int *nlon_in, const int *nlat_in, const int *nlon_out, const int *nlat_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *i_out, int *j_out, double *xgrid_area, double *xgrid_clon, double *xgrid_clat)
Definition: create_xgrid.c:693
int create_xgrid_1dx2d_order1_ug_(const int *nlon_in, const int *nlat_in, const int *npts_out, const double *lon_in, const double *lat_in, const double *lon_out, const double *lat_out, const double *mask_in, int *i_in, int *j_in, int *l_out, double *xgrid_area)
Definition: create_xgrid.c:379