Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
df40971c
Commit
df40971c
authored
Mar 29, 2016
by
Uwe Schulzweida
Browse files
distgrid: check availabylity of coordinates
parent
eeb0a8ce
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/Distgrid.c
View file @
df40971c
...
...
@@ -42,27 +42,47 @@ void genGrids(int gridID1, int *gridIDs, int nxvals, int nyvals, int nxblocks, i
int
nx
=
gridInqXsize
(
gridID1
);
int
ny
=
gridInqYsize
(
gridID1
);
bool
lxcoord
=
true
;
bool
lycoord
=
true
;
if
(
gridInqXvals
(
gridID1
,
NULL
)
==
0
)
lxcoord
=
false
;
if
(
gridInqYvals
(
gridID1
,
NULL
)
==
0
)
lycoord
=
false
;
double
*
xvals
=
NULL
,
*
yvals
=
NULL
;
double
*
xvals2
=
NULL
,
*
yvals2
=
NULL
;
if
(
lregular
)
if
(
lxcoord
)
{
xvals
=
(
double
*
)
Malloc
(
nx
*
sizeof
(
double
));
yvals
=
(
double
*
)
Malloc
(
ny
*
sizeof
(
double
));
if
(
lregular
)
{
xvals
=
(
double
*
)
Malloc
(
nx
*
sizeof
(
double
));
}
else
{
xvals
=
(
double
*
)
Malloc
(
nx
*
ny
*
sizeof
(
double
));
xvals2
=
(
double
*
)
Malloc
(
nxvals
*
nyvals
*
sizeof
(
double
));
}
gridInqXvals
(
gridID1
,
xvals
);
}
else
if
(
lycoord
)
{
xvals
=
(
double
*
)
Malloc
(
nx
*
ny
*
sizeof
(
double
));
yvals
=
(
double
*
)
Malloc
(
nx
*
ny
*
sizeof
(
double
));
xvals2
=
(
double
*
)
Malloc
(
nxvals
*
nyvals
*
sizeof
(
double
));
yvals2
=
(
double
*
)
Malloc
(
nxvals
*
nyvals
*
sizeof
(
double
));
if
(
lregular
)
{
yvals
=
(
double
*
)
Malloc
(
ny
*
sizeof
(
double
));
}
else
{
yvals
=
(
double
*
)
Malloc
(
nx
*
ny
*
sizeof
(
double
));
yvals2
=
(
double
*
)
Malloc
(
nxvals
*
nyvals
*
sizeof
(
double
));
}
gridInqYvals
(
gridID1
,
yvals
);
}
int
*
xlsize
=
(
int
*
)
Malloc
(
nxblocks
*
sizeof
(
int
));
int
*
ylsize
=
(
int
*
)
Malloc
(
nyblocks
*
sizeof
(
int
));
gridInqXvals
(
gridID1
,
xvals
);
gridInqYvals
(
gridID1
,
yvals
);
for
(
ix
=
0
;
ix
<
nxblocks
;
++
ix
)
xlsize
[
ix
]
=
nxvals
;
if
(
nx
%
nxblocks
!=
0
)
xlsize
[
nxblocks
-
1
]
=
nx
-
(
nxblocks
-
1
)
*
nxvals
;
if
(
cdoVerbose
)
for
(
ix
=
0
;
ix
<
nxblocks
;
++
ix
)
cdoPrint
(
"xblock %d: %d"
,
ix
,
xlsize
[
ix
]);
...
...
@@ -89,8 +109,8 @@ void genGrids(int gridID1, int *gridIDs, int nxvals, int nyvals, int nxblocks, i
// printf(">> %d %d %d\n", j, i, offset + j*nx + i);
if
(
!
lregular
)
{
xvals2
[
gridsize2
]
=
xvals
[
offset
+
j
*
nx
+
i
];
yvals2
[
gridsize2
]
=
yvals
[
offset
+
j
*
nx
+
i
];
if
(
lxcoord
)
xvals2
[
gridsize2
]
=
xvals
[
offset
+
j
*
nx
+
i
];
if
(
lycoord
)
yvals2
[
gridsize2
]
=
yvals
[
offset
+
j
*
nx
+
i
];
}
gridindex
[
index
][
gridsize2
++
]
=
offset
+
j
*
nx
+
i
;
}
...
...
@@ -103,13 +123,13 @@ void genGrids(int gridID1, int *gridIDs, int nxvals, int nyvals, int nxblocks, i
if
(
lregular
)
{
gridDefXvals
(
gridID2
,
xvals
+
ix
*
nxvals
);
gridDefYvals
(
gridID2
,
yvals
+
iy
*
nyvals
);
if
(
lxcoord
)
gridDefXvals
(
gridID2
,
xvals
+
ix
*
nxvals
);
if
(
lycoord
)
gridDefYvals
(
gridID2
,
yvals
+
iy
*
nyvals
);
}
else
{
gridDefXvals
(
gridID2
,
xvals2
);
gridDefYvals
(
gridID2
,
yvals2
);
if
(
lxcoord
)
gridDefXvals
(
gridID2
,
xvals2
);
if
(
lycoord
)
gridDefYvals
(
gridID2
,
yvals2
);
}
gridIDs
[
index
]
=
gridID2
;
...
...
src/config.h.in
View file @
df40971c
...
...
@@ -270,11 +270,6 @@
/* Version number of package */
#undef VERSION
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
...
...
src/operator_help.h
View file @
df40971c
...
...
@@ -448,7 +448,7 @@ static const char *CollgridHelp[] = {
" This operator collects the data of the input files to one output file. "
,
" All input files need to have the same variables and the same number of timesteps on a different"
,
" horizonal grid region. A source region must be a structured longitude/latitude grid box."
,
" The parameter nx needs to be specified only non regular lon/lat grids."
,
" The parameter nx needs to be specified only
for
non regular lon/lat grids."
,
""
,
"PARAMETER"
,
" nx INTEGER Number of regions in x direction [default: number of input files]"
,
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment