Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cdo
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
cdo
Commits
bc1a2242
Commit
bc1a2242
authored
8 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
Changed type of gridsize to size_t.
parent
7f797a4e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/grid.c
+63
-63
63 additions, 63 deletions
src/grid.c
src/grid.h
+13
-17
13 additions, 17 deletions
src/grid.h
with
76 additions
and
80 deletions
src/grid.c
+
63
−
63
View file @
bc1a2242
...
...
@@ -127,12 +127,12 @@ int nlat_to_nlon(int nlat)
static
void
scale_vec
(
double
scalefactor
,
long
nvals
,
double
*
restrict
values
)
void
scale_vec
(
double
scalefactor
,
size_t
nvals
,
double
*
restrict
values
)
{
#if defined(_OPENMP)
#pragma omp parallel for default(none) shared(nvals, scalefactor, values)
#endif
for
(
long
n
=
0
;
n
<
nvals
;
++
n
)
for
(
size_t
n
=
0
;
n
<
nvals
;
++
n
)
{
values
[
n
]
*=
scalefactor
;
}
...
...
@@ -175,7 +175,7 @@ void grid_copy_mapping(int gridID1, int gridID2)
}
void
grid_to_radian
(
const
char
*
units
,
long
nvals
,
double
*
restrict
values
,
const
char
*
description
)
void
grid_to_radian
(
const
char
*
units
,
size_t
nvals
,
double
*
restrict
values
,
const
char
*
description
)
{
if
(
cmpstr
(
units
,
"degree"
)
==
0
)
{
...
...
@@ -192,11 +192,11 @@ void grid_to_radian(const char *units, long nvals, double *restrict values, cons
}
void
grid_to_degree
(
const
char
*
units
,
long
nvals
,
double
*
restrict
values
,
const
char
*
description
)
void
grid_to_degree
(
const
char
*
units
,
size_t
nvals
,
double
*
restrict
values
,
const
char
*
description
)
{
if
(
cmpstr
(
units
,
"radian"
)
==
0
)
{
for
(
long
n
=
0
;
n
<
nvals
;
++
n
)
values
[
n
]
*=
RAD2DEG
;
for
(
size_t
n
=
0
;
n
<
nvals
;
++
n
)
values
[
n
]
*=
RAD2DEG
;
}
else
if
(
cmpstr
(
units
,
"degree"
)
==
0
)
{
...
...
@@ -212,7 +212,7 @@ void grid_to_degree(const char *units, long nvals, double *restrict values, cons
int
gridToZonal
(
int
gridID1
)
{
int
gridtype
=
gridInqType
(
gridID1
);
in
t
gridsize
=
gridInqYsize
(
gridID1
);
size_
t
gridsize
=
gridInqYsize
(
gridID1
);
int
gridID2
=
gridCreate
(
gridtype
,
gridsize
);
if
(
gridtype
==
GRID_LONLAT
||
...
...
@@ -245,7 +245,7 @@ int gridToZonal(int gridID1)
int
gridToMeridional
(
int
gridID1
)
{
int
gridtype
=
gridInqType
(
gridID1
);
in
t
gridsize
=
gridInqXsize
(
gridID1
);
size_
t
gridsize
=
gridInqXsize
(
gridID1
);
int
gridID2
=
gridCreate
(
gridtype
,
gridsize
);
if
(
gridtype
==
GRID_LONLAT
||
...
...
@@ -275,7 +275,7 @@ int gridToMeridional(int gridID1)
}
void
grid_gen_corners
(
in
t
n
,
const
double
*
restrict
vals
,
double
*
restrict
corners
)
void
grid_gen_corners
(
size_
t
n
,
const
double
*
restrict
vals
,
double
*
restrict
corners
)
{
if
(
n
==
1
)
{
...
...
@@ -284,7 +284,7 @@ void grid_gen_corners(int n, const double* restrict vals, double* restrict corne
}
else
{
for
(
in
t
i
=
0
;
i
<
n
-
1
;
++
i
)
for
(
size_
t
i
=
0
;
i
<
n
-
1
;
++
i
)
corners
[
i
+
1
]
=
0
.
5
*
(
vals
[
i
]
+
vals
[
i
+
1
]);
corners
[
0
]
=
2
*
vals
[
0
]
-
corners
[
1
];
...
...
@@ -293,9 +293,9 @@ void grid_gen_corners(int n, const double* restrict vals, double* restrict corne
}
void
grid_gen_bounds
(
in
t
n
,
const
double
*
restrict
vals
,
double
*
restrict
bounds
)
void
grid_gen_bounds
(
size_
t
n
,
const
double
*
restrict
vals
,
double
*
restrict
bounds
)
{
for
(
in
t
i
=
0
;
i
<
n
-
1
;
++
i
)
for
(
size_
t
i
=
0
;
i
<
n
-
1
;
++
i
)
{
bounds
[
2
*
i
+
1
]
=
0
.
5
*
(
vals
[
i
]
+
vals
[
i
+
1
]);
bounds
[
2
*
(
i
+
1
)]
=
0
.
5
*
(
vals
[
i
]
+
vals
[
i
+
1
]);
...
...
@@ -321,7 +321,7 @@ void grid_check_lat_borders(int n, double *ybounds)
}
void
grid_cell_center_to_bounds_X2D
(
const
char
*
xunitstr
,
long
xsize
,
long
ysize
,
const
double
*
restrict
grid_center_lon
,
void
grid_cell_center_to_bounds_X2D
(
const
char
*
xunitstr
,
size_t
xsize
,
size_t
ysize
,
const
double
*
restrict
grid_center_lon
,
double
*
restrict
grid_corner_lon
,
double
dlon
)
{
(
void
)
xunitstr
;
...
...
@@ -331,13 +331,13 @@ void grid_cell_center_to_bounds_X2D(const char* xunitstr, long xsize, long ysize
if ( xsize == 1 || (grid_center_lon[xsize-1]-grid_center_lon[0]+dlon) < 359 )
cdoAbort("Cannot calculate Xbounds for %d vals with dlon = %g", xsize, dlon);
*/
for
(
in
t
i
=
0
;
i
<
xsize
;
++
i
)
for
(
size_
t
i
=
0
;
i
<
xsize
;
++
i
)
{
double
minlon
=
grid_center_lon
[
i
]
-
0
.
5
*
dlon
;
double
maxlon
=
grid_center_lon
[
i
]
+
0
.
5
*
dlon
;
for
(
in
t
j
=
0
;
j
<
ysize
;
++
j
)
for
(
size_
t
j
=
0
;
j
<
ysize
;
++
j
)
{
in
t
index
=
(
j
<<
2
)
*
xsize
+
(
i
<<
2
);
size_
t
index
=
(
j
<<
2
)
*
xsize
+
(
i
<<
2
);
grid_corner_lon
[
index
]
=
minlon
;
grid_corner_lon
[
index
+
1
]
=
maxlon
;
grid_corner_lon
[
index
+
2
]
=
maxlon
;
...
...
@@ -378,7 +378,7 @@ double genYmax(double y1, double y2)
/*****************************************************************************/
void
grid_cell_center_to_bounds_Y2D
(
const
char
*
yunitstr
,
long
xsize
,
long
ysize
,
const
double
*
restrict
grid_center_lat
,
double
*
restrict
grid_corner_lat
)
void
grid_cell_center_to_bounds_Y2D
(
const
char
*
yunitstr
,
size_t
xsize
,
size_t
ysize
,
const
double
*
restrict
grid_center_lat
,
double
*
restrict
grid_corner_lat
)
{
(
void
)
yunitstr
;
...
...
@@ -389,7 +389,7 @@ void grid_cell_center_to_bounds_Y2D(const char* yunitstr, long xsize, long ysize
// if ( ysize == 1 ) cdoAbort("Cannot calculate Ybounds for 1 value!");
for
(
in
t
j
=
0
;
j
<
ysize
;
++
j
)
for
(
size_
t
j
=
0
;
j
<
ysize
;
++
j
)
{
if
(
ysize
==
1
)
{
...
...
@@ -398,7 +398,7 @@ void grid_cell_center_to_bounds_Y2D(const char* yunitstr, long xsize, long ysize
}
else
{
in
t
index
=
j
*
xsize
;
size_
t
index
=
j
*
xsize
;
if
(
firstlat
>
lastlat
)
{
if
(
j
==
0
)
...
...
@@ -425,9 +425,9 @@ void grid_cell_center_to_bounds_Y2D(const char* yunitstr, long xsize, long ysize
}
}
for
(
in
t
i
=
0
;
i
<
xsize
;
++
i
)
for
(
size_
t
i
=
0
;
i
<
xsize
;
++
i
)
{
in
t
index
=
(
j
<<
2
)
*
xsize
+
(
i
<<
2
);
size_
t
index
=
(
j
<<
2
)
*
xsize
+
(
i
<<
2
);
grid_corner_lat
[
index
]
=
minlat
;
grid_corner_lat
[
index
+
1
]
=
minlat
;
grid_corner_lat
[
index
+
2
]
=
maxlat
;
...
...
@@ -437,13 +437,13 @@ void grid_cell_center_to_bounds_Y2D(const char* yunitstr, long xsize, long ysize
}
static
void
gridGenRotBounds
(
double
xpole
,
double
ypole
,
double
angle
,
in
t
nx
,
in
t
ny
,
void
gridGenRotBounds
(
double
xpole
,
double
ypole
,
double
angle
,
size_
t
nx
,
size_
t
ny
,
double
*
xbounds
,
double
*
ybounds
,
double
*
xbounds2D
,
double
*
ybounds2D
)
{
double
minlon
,
maxlon
;
double
minlat
,
maxlat
;
for
(
in
t
j
=
0
;
j
<
ny
;
j
++
)
for
(
size_
t
j
=
0
;
j
<
ny
;
j
++
)
{
if
(
ybounds
[
0
]
>
ybounds
[
1
]
)
{
...
...
@@ -456,12 +456,12 @@ void gridGenRotBounds(double xpole, double ypole, double angle, int nx, int ny,
minlat
=
ybounds
[
2
*
j
];
}
for
(
in
t
i
=
0
;
i
<
nx
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
nx
;
i
++
)
{
minlon
=
xbounds
[
2
*
i
];
maxlon
=
xbounds
[
2
*
i
+
1
];
in
t
index
=
j
*
4
*
nx
+
4
*
i
;
size_
t
index
=
j
*
4
*
nx
+
4
*
i
;
xbounds2D
[
index
+
0
]
=
lamrot_to_lam
(
minlat
,
minlon
,
ypole
,
xpole
,
angle
);
xbounds2D
[
index
+
1
]
=
lamrot_to_lam
(
minlat
,
maxlon
,
ypole
,
xpole
,
angle
);
xbounds2D
[
index
+
2
]
=
lamrot_to_lam
(
maxlat
,
maxlon
,
ypole
,
xpole
,
angle
);
...
...
@@ -476,19 +476,19 @@ void gridGenRotBounds(double xpole, double ypole, double angle, int nx, int ny,
}
void
grid_gen_xbounds2D
(
in
t
nx
,
in
t
ny
,
const
double
*
restrict
xbounds
,
double
*
restrict
xbounds2D
)
void
grid_gen_xbounds2D
(
size_
t
nx
,
size_
t
ny
,
const
double
*
restrict
xbounds
,
double
*
restrict
xbounds2D
)
{
#if defined(_OPENMP)
#pragma omp parallel for default(none) shared(nx, ny, xbounds, xbounds2D)
#endif
for
(
in
t
i
=
0
;
i
<
nx
;
++
i
)
for
(
size_
t
i
=
0
;
i
<
nx
;
++
i
)
{
double
minlon
=
xbounds
[
2
*
i
];
double
maxlon
=
xbounds
[
2
*
i
+
1
];
for
(
in
t
j
=
0
;
j
<
ny
;
++
j
)
for
(
size_
t
j
=
0
;
j
<
ny
;
++
j
)
{
in
t
index
=
j
*
4
*
nx
+
4
*
i
;
size_
t
index
=
j
*
4
*
nx
+
4
*
i
;
xbounds2D
[
index
]
=
minlon
;
xbounds2D
[
index
+
1
]
=
maxlon
;
xbounds2D
[
index
+
2
]
=
maxlon
;
...
...
@@ -498,12 +498,12 @@ void grid_gen_xbounds2D(int nx, int ny, const double *restrict xbounds, double *
}
void
grid_gen_ybounds2D
(
in
t
nx
,
in
t
ny
,
const
double
*
restrict
ybounds
,
double
*
restrict
ybounds2D
)
void
grid_gen_ybounds2D
(
size_
t
nx
,
size_
t
ny
,
const
double
*
restrict
ybounds
,
double
*
restrict
ybounds2D
)
{
#if defined(_OPENMP)
#pragma omp parallel for default(none) shared(nx, ny, ybounds, ybounds2D)
#endif
for
(
in
t
j
=
0
;
j
<
ny
;
++
j
)
for
(
size_
t
j
=
0
;
j
<
ny
;
++
j
)
{
double
minlat
,
maxlat
;
if
(
ybounds
[
0
]
>
ybounds
[
1
]
)
...
...
@@ -517,9 +517,9 @@ void grid_gen_ybounds2D(int nx, int ny, const double *restrict ybounds, double *
minlat
=
ybounds
[
2
*
j
];
}
for
(
in
t
i
=
0
;
i
<
nx
;
++
i
)
for
(
size_
t
i
=
0
;
i
<
nx
;
++
i
)
{
in
t
index
=
j
*
4
*
nx
+
4
*
i
;
size_
t
index
=
j
*
4
*
nx
+
4
*
i
;
ybounds2D
[
index
]
=
minlat
;
ybounds2D
[
index
+
1
]
=
minlat
;
ybounds2D
[
index
+
2
]
=
maxlat
;
...
...
@@ -537,7 +537,7 @@ void grid_gen_ybounds2D(int nx, int ny, const double *restrict ybounds, double *
*
*/
static
void
grib_get_reduced_row
(
long
pl
,
double
lon_first
,
double
lon_last
,
long
*
npoints
,
long
*
ilon_first
,
long
*
ilon_last
)
void
grib_get_reduced_row
(
long
pl
,
double
lon_first
,
double
lon_last
,
long
*
npoints
,
long
*
ilon_first
,
long
*
ilon_last
)
{
double
dlon_first
=
0
,
dlon_last
=
0
;
...
...
@@ -592,7 +592,7 @@ void grib_get_reduced_row(long pl,double lon_first,double lon_last,long* npoints
}
static
int
qu2reg_subarea
(
in
t
gridsize
,
int
np
,
double
xfirst
,
double
xlast
,
int
qu2reg_subarea
(
size_
t
gridsize
,
int
np
,
double
xfirst
,
double
xlast
,
double
*
array
,
int
*
rowlon
,
int
ny
,
double
missval
,
int
*
iret
,
int
lmiss
,
int
lperio
,
int
lveggy
)
{
/* sub area (longitudes) */
...
...
@@ -602,7 +602,7 @@ int qu2reg_subarea(int gridsize, int np, double xfirst, double xlast,
long
row_count
;
int
rlon
,
nwork
=
0
;
int
np4
=
np
*
4
;
in
t
size
=
0
;
size_
t
size
=
0
;
int
wlen
;
int
ii
;
...
...
@@ -855,16 +855,16 @@ char *grid_get_proj4param(int gridID)
int
gridToCurvilinear
(
int
gridID1
,
int
lbounds
)
{
in
t
index
;
size_
t
index
;
int
gridtype
=
gridInqType
(
gridID1
);
in
t
nx
=
gridInqXsize
(
gridID1
);
in
t
ny
=
gridInqYsize
(
gridID1
);
size_
t
nx
=
gridInqXsize
(
gridID1
);
size_
t
ny
=
gridInqYsize
(
gridID1
);
bool
lxyvals
=
gridInqXvals
(
gridID1
,
NULL
)
&&
gridInqYvals
(
gridID1
,
NULL
);
if
(
!
lxyvals
&&
gridtype
!=
GRID_LCC
)
cdoAbort
(
"Grid coordinates missing!"
);
in
t
gridsize
=
gridInqSize
(
gridID1
);
size_
t
gridsize
=
gridInqSize
(
gridID1
);
int
gridID2
=
gridCreate
(
GRID_CURVILINEAR
,
gridsize
);
gridDefPrec
(
gridID2
,
CDI_DATATYPE_FLT32
);
...
...
@@ -943,20 +943,20 @@ int gridToCurvilinear(int gridID1, int lbounds)
if
(
gridInqXvals
(
gridID1
,
NULL
)
)
gridInqXvals
(
gridID1
,
xvals
);
else
for
(
in
t
i
=
0
;
i
<
nx
;
++
i
)
xvals
[
i
]
=
0
;
for
(
size_
t
i
=
0
;
i
<
nx
;
++
i
)
xvals
[
i
]
=
0
;
if
(
gridInqYvals
(
gridID1
,
NULL
)
)
gridInqYvals
(
gridID1
,
yvals
);
else
for
(
in
t
i
=
0
;
i
<
ny
;
++
i
)
yvals
[
i
]
=
0
;
for
(
size_
t
i
=
0
;
i
<
ny
;
++
i
)
yvals
[
i
]
=
0
;
if
(
lproj_rll
)
{
gridInqParamRLL
(
gridID1
,
&
xpole
,
&
ypole
,
&
angle
);
gridDefProj
(
gridID2
,
gridID1
);
for
(
in
t
j
=
0
;
j
<
ny
;
j
++
)
for
(
in
t
i
=
0
;
i
<
nx
;
i
++
)
for
(
size_
t
j
=
0
;
j
<
ny
;
j
++
)
for
(
size_
t
i
=
0
;
i
<
nx
;
i
++
)
{
xvals2D
[
j
*
nx
+
i
]
=
lamrot_to_lam
(
yvals
[
j
],
xvals
[
i
],
ypole
,
xpole
,
angle
);
yvals2D
[
j
*
nx
+
i
]
=
phirot_to_phi
(
yvals
[
j
],
xvals
[
i
],
ypole
,
angle
);
...
...
@@ -964,8 +964,8 @@ int gridToCurvilinear(int gridID1, int lbounds)
}
else
{
for
(
in
t
j
=
0
;
j
<
ny
;
j
++
)
for
(
in
t
i
=
0
;
i
<
nx
;
i
++
)
for
(
size_
t
j
=
0
;
j
<
ny
;
j
++
)
for
(
size_
t
i
=
0
;
i
<
nx
;
i
++
)
{
xvals2D
[
j
*
nx
+
i
]
=
xscale
*
xvals
[
i
];
yvals2D
[
j
*
nx
+
i
]
=
yscale
*
yvals
[
j
];
...
...
@@ -1040,8 +1040,8 @@ int gridToCurvilinear(int gridID1, int lbounds)
{
if
(
lproj_sinu
||
lproj_laea
||
lproj_lcc
||
lproj4
)
{
for
(
in
t
j
=
0
;
j
<
ny
;
j
++
)
for
(
in
t
i
=
0
;
i
<
nx
;
i
++
)
for
(
size_
t
j
=
0
;
j
<
ny
;
j
++
)
for
(
size_
t
i
=
0
;
i
<
nx
;
i
++
)
{
index
=
j
*
4
*
nx
+
4
*
i
;
...
...
@@ -1101,7 +1101,7 @@ int gridToCurvilinear(int gridID1, int lbounds)
}
int
gridToUnstructuredSelecton
(
int
gridID1
,
in
t
selectionSize
,
int
*
selectionIndexList
,
int
nocoords
,
int
nobounds
)
int
gridToUnstructuredSelecton
(
int
gridID1
,
size_
t
selectionSize
,
int
*
selectionIndexList
,
int
nocoords
,
int
nobounds
)
{
/* transform input grid into a unstructured Version if necessary {{{ */
int
unstructuredGridID
;
...
...
@@ -1110,7 +1110,7 @@ int gridToUnstructuredSelecton(int gridID1, int selectionSize, int *selectionInd
else
unstructuredGridID
=
gridToUnstructured
(
gridID1
,
!
nobounds
);
in
t
unstructuredGridSize
=
gridInqSize
(
unstructuredGridID
);
size_
t
unstructuredGridSize
=
gridInqSize
(
unstructuredGridID
);
int
unstructuredSelectionGridID
=
gridCreate
(
GRID_UNSTRUCTURED
,
selectionSize
);
...
...
@@ -1135,7 +1135,7 @@ int gridToUnstructuredSelecton(int gridID1, int selectionSize, int *selectionInd
double
*
xvals
=
(
double
*
)
Malloc
(
selectionSize
*
sizeof
(
double
));
double
*
yvals
=
(
double
*
)
Malloc
(
selectionSize
*
sizeof
(
double
));
for
(
in
t
i
=
0
;
i
<
selectionSize
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
selectionSize
;
i
++
)
{
xvals
[
i
]
=
xvalsUnstructured
[
selectionIndexList
[
i
]];
yvals
[
i
]
=
yvalsUnstructured
[
selectionIndexList
[
i
]];
...
...
@@ -1151,16 +1151,16 @@ int gridToUnstructuredSelecton(int gridID1, int selectionSize, int *selectionInd
/* copy bounds if requested {{{ */
if
(
!
nobounds
)
{
in
t
nvertex
=
gridInqNvertex
(
unstructuredGridID
);
size_
t
nvertex
=
gridInqNvertex
(
unstructuredGridID
);
double
*
xbounds
=
(
double
*
)
Malloc
(
nvertex
*
selectionSize
*
sizeof
(
double
));
double
*
ybounds
=
(
double
*
)
Malloc
(
nvertex
*
selectionSize
*
sizeof
(
double
));
double
*
xboundsUnstructured
=
(
double
*
)
Malloc
(
nvertex
*
unstructuredGridSize
*
sizeof
(
double
));
double
*
yboundsUnstructured
=
(
double
*
)
Malloc
(
nvertex
*
unstructuredGridSize
*
sizeof
(
double
));
gridInqXbounds
(
unstructuredGridID
,
xboundsUnstructured
);
gridInqYbounds
(
unstructuredGridID
,
yboundsUnstructured
);
for
(
in
t
i
=
0
;
i
<
selectionSize
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
selectionSize
;
i
++
)
{
for
(
in
t
k
=
0
;
k
<
nvertex
;
k
++
)
for
(
size_
t
k
=
0
;
k
<
nvertex
;
k
++
)
{
xbounds
[
i
*
nvertex
+
k
]
=
xboundsUnstructured
[
selectionIndexList
[
i
]
*
nvertex
+
k
];
ybounds
[
i
*
nvertex
+
k
]
=
yboundsUnstructured
[
selectionIndexList
[
i
]
*
nvertex
+
k
];
...
...
@@ -1189,7 +1189,7 @@ int gridToUnstructuredSelecton(int gridID1, int selectionSize, int *selectionInd
int
gridToUnstructured
(
int
gridID1
,
int
lbounds
)
{
int
gridtype
=
gridInqType
(
gridID1
);
in
t
gridsize
=
gridInqSize
(
gridID1
);
size_
t
gridsize
=
gridInqSize
(
gridID1
);
int
gridID2
=
gridCreate
(
GRID_UNSTRUCTURED
,
gridsize
);
gridDefPrec
(
gridID2
,
CDI_DATATYPE_FLT32
);
...
...
@@ -1215,8 +1215,8 @@ int gridToUnstructured(int gridID1, int lbounds)
gridDefNvertex
(
gridID2
,
4
);
in
t
nx
=
gridInqXsize
(
gridID1
);
in
t
ny
=
gridInqYsize
(
gridID1
);
size_
t
nx
=
gridInqXsize
(
gridID1
);
size_
t
ny
=
gridInqYsize
(
gridID1
);
gridDefXsize
(
gridID2
,
gridsize
);
gridDefYsize
(
gridID2
,
gridsize
);
...
...
@@ -1234,8 +1234,8 @@ int gridToUnstructured(int gridID1, int lbounds)
{
gridInqParamRLL
(
gridID1
,
&
xpole
,
&
ypole
,
&
angle
);
for
(
in
t
j
=
0
;
j
<
ny
;
j
++
)
for
(
in
t
i
=
0
;
i
<
nx
;
i
++
)
for
(
size_
t
j
=
0
;
j
<
ny
;
j
++
)
for
(
size_
t
i
=
0
;
i
<
nx
;
i
++
)
{
xvals2D
[
j
*
nx
+
i
]
=
lamrot_to_lam
(
yvals
[
j
],
xvals
[
i
],
ypole
,
xpole
,
angle
);
yvals2D
[
j
*
nx
+
i
]
=
phirot_to_phi
(
yvals
[
j
],
xvals
[
i
],
ypole
,
angle
);
...
...
@@ -1243,8 +1243,8 @@ int gridToUnstructured(int gridID1, int lbounds)
}
else
{
for
(
in
t
j
=
0
;
j
<
ny
;
j
++
)
for
(
in
t
i
=
0
;
i
<
nx
;
i
++
)
for
(
size_
t
j
=
0
;
j
<
ny
;
j
++
)
for
(
size_
t
i
=
0
;
i
<
nx
;
i
++
)
{
xvals2D
[
j
*
nx
+
i
]
=
xvals
[
i
];
yvals2D
[
j
*
nx
+
i
]
=
yvals
[
j
];
...
...
@@ -1327,7 +1327,7 @@ int gridToUnstructured(int gridID1, int lbounds)
}
case
GRID_GME
:
{
in
t
nv
=
6
;
size_
t
nv
=
6
;
double
*
xbounds
=
NULL
,
*
ybounds
=
NULL
;
int
nd
,
ni
,
ni2
,
ni3
;
...
...
@@ -1344,13 +1344,13 @@ int gridToUnstructured(int gridID1, int lbounds)
gme_grid
(
lbounds
,
gridsize
,
xvals
,
yvals
,
xbounds
,
ybounds
,
imask
,
ni
,
nd
,
ni2
,
ni3
);
for
(
in
t
i
=
0
;
i
<
gridsize
;
i
++
)
for
(
size_
t
i
=
0
;
i
<
gridsize
;
i
++
)
{
xvals
[
i
]
*=
RAD2DEG
;
yvals
[
i
]
*=
RAD2DEG
;
if
(
lbounds
)
for
(
in
t
j
=
0
;
j
<
nv
;
j
++
)
for
(
size_
t
j
=
0
;
j
<
nv
;
j
++
)
{
xbounds
[
i
*
nv
+
j
]
*=
RAD2DEG
;
ybounds
[
i
*
nv
+
j
]
*=
RAD2DEG
;
...
...
This diff is collapsed.
Click to expand it.
src/grid.h
+
13
−
17
View file @
bc1a2242
...
...
@@ -39,29 +39,29 @@ void grid_def_param_sinu(int gridID);
bool
grid_is_distance_generic
(
int
gridID
);
void
grid_to_radian
(
const
char
*
units
,
long
nvals
,
double
*
restrict
values
,
const
char
*
description
);
void
grid_to_degree
(
const
char
*
units
,
long
nvals
,
double
*
restrict
values
,
const
char
*
description
);
void
grid_to_radian
(
const
char
*
units
,
size_t
nvals
,
double
*
restrict
values
,
const
char
*
description
);
void
grid_to_degree
(
const
char
*
units
,
size_t
nvals
,
double
*
restrict
values
,
const
char
*
description
);
void
grid_gen_corners
(
in
t
n
,
const
double
*
restrict
vals
,
double
*
restrict
corners
);
void
grid_gen_bounds
(
in
t
n
,
const
double
*
restrict
vals
,
double
*
restrict
bounds
);
void
grid_gen_corners
(
size_
t
n
,
const
double
*
restrict
vals
,
double
*
restrict
corners
);
void
grid_gen_bounds
(
size_
t
n
,
const
double
*
restrict
vals
,
double
*
restrict
bounds
);
void
grid_check_lat_borders
(
int
n
,
double
*
ybounds
);
void
grid_gen_xbounds2D
(
in
t
nx
,
in
t
ny
,
const
double
*
restrict
xbounds
,
double
*
restrict
xbounds2D
);
void
grid_gen_ybounds2D
(
in
t
nx
,
in
t
ny
,
const
double
*
restrict
ybounds
,
double
*
restrict
ybounds2D
);
void
grid_gen_xbounds2D
(
size_
t
nx
,
size_
t
ny
,
const
double
*
restrict
xbounds
,
double
*
restrict
xbounds2D
);
void
grid_gen_ybounds2D
(
size_
t
nx
,
size_
t
ny
,
const
double
*
restrict
ybounds
,
double
*
restrict
ybounds2D
);
void
grid_cell_center_to_bounds_X2D
(
const
char
*
xunitstr
,
long
xsize
,
long
ysize
,
const
double
*
restrict
grid_center_lon
,
double
*
restrict
grid_corner_lon
,
double
dlon
);
void
grid_cell_center_to_bounds_Y2D
(
const
char
*
yunitstr
,
long
xsize
,
long
ysize
,
const
double
*
restrict
grid_center_lat
,
double
*
restrict
grid_corner_lat
);
void
grid_cell_center_to_bounds_X2D
(
const
char
*
xunitstr
,
size_t
xsize
,
size_t
ysize
,
const
double
*
restrict
grid_center_lon
,
double
*
restrict
grid_corner_lon
,
double
dlon
);
void
grid_cell_center_to_bounds_Y2D
(
const
char
*
yunitstr
,
size_t
xsize
,
size_t
ysize
,
const
double
*
restrict
grid_center_lat
,
double
*
restrict
grid_corner_lat
);
int
gridWeights
(
int
gridID
,
double
*
weights
);
int
gridGenArea
(
int
gridID
,
double
*
area
);
int
gridWeights
(
int
gridID
,
double
*
weights
);
int
gridGenArea
(
int
gridID
,
double
*
area
);
int
referenceToGrid
(
int
gridID
);
int
gridToZonal
(
int
gridID
);
int
gridToMeridional
(
int
gridID
);
int
gridToUnstructured
(
int
gridID
,
int
lbounds
);
int
gridToUnstructuredSelecton
(
int
gridID1
,
in
t
selectionSize
,
int
*
selectionIndexList
,
int
nocoords
,
int
nobounds
);
int
gridToUnstructuredSelecton
(
int
gridID1
,
size_
t
selectionSize
,
int
*
selectionIndexList
,
int
nocoords
,
int
nobounds
);
int
gridToCurvilinear
(
int
gridID
,
int
lbounds
);
int
gridCurvilinearToRegular
(
int
gridID
);
int
gridToRegular
(
int
gridID
);
...
...
@@ -104,10 +104,6 @@ int cdo_define_sample_grid(int gridID, int sampleFactor);
int
cdo_define_subgrid_grid
(
int
gridSrcID
,
int
subI0
,
int
subI1
,
int
subJ0
,
int
subJ1
);
int
cdo_lonlat_to_lcc
(
int
gridID
,
size_t
nvals
,
double
*
xvals
,
double
*
yvals
);
int
cdo_lcc_to_lonlat
(
int
gridID
,
size_t
nvals
,
double
*
xvals
,
double
*
yvals
);
#ifdef __cplusplus
extern
"C"
{
#endif
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment