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
a1367ce7
Commit
a1367ce7
authored
1 year ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
Remapgrid: add support for multi remap files
parent
442ef4c8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!143
M214003/develop
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Remapgrid.cc
+21
-6
21 additions, 6 deletions
src/Remapgrid.cc
src/Remapweights.cc
+10
-0
10 additions, 0 deletions
src/Remapweights.cc
with
31 additions
and
6 deletions
src/Remapgrid.cc
+
21
−
6
View file @
a1367ce7
...
...
@@ -31,6 +31,7 @@
#include
"griddes.h"
#include
"cdo_options.h"
#include
"util_string.h"
#include
"util_wildcards.h"
static
int
maptype_to_operfunc
(
const
RemapSwitches
&
remapSwitches
)
...
...
@@ -294,7 +295,7 @@ class ModuleRemapgrid
bool
remap_genweights
=
Options
::
REMAP_genweights
;
int
numRemaps
=
0
;
int
numNeighbors
=
0
;
std
::
string
remapWeightsFile
;
std
::
vector
<
std
::
string
>
remapWeightsFile
s
;
CdoStreamID
streamID1
;
int
taxisID1
;
...
...
@@ -356,7 +357,7 @@ public:
{
operator_input_arg
(
"grid description file or name, remap weights file (SCRIP NetCDF)"
);
operator_check_argc
(
2
);
remapWeightsFile
=
cdo_operator_argv
(
1
);
remapWeightsFile
s
.
push_back
(
cdo_operator_argv
(
1
)
)
;
}
else
{
...
...
@@ -408,13 +409,27 @@ public:
if
(
doRemap
)
{
numRemaps
=
1
;
int
gridIndex1
;
for
(
gridIndex1
=
0
;
gridIndex1
<
numGrids
;
++
gridIndex1
)
if
(
remapGrids
[
gridIndex1
])
break
;
auto
gridID1
=
vlistGrid
(
vlistID1
,
gridIndex1
);
remapSwitches
=
remap_read_weights
(
remapWeightsFile
,
gridID1
,
gridID2
,
remaps
[
0
],
extrapolateIsSet
,
remapExtrapolate
);
operfunc
=
maptype_to_operfunc
(
remapSwitches
);
remapWeightsFiles
=
expand_path_names
(
remapWeightsFiles
);
for
(
auto
&
remapWeightsFile
:
remapWeightsFiles
)
{
// printf("read remapWeightsFile %d: %s\n", numRemaps+1, remapWeightsFile.c_str());
auto
&
remap
=
remaps
[
numRemaps
];
remapSwitches
=
remap_read_weights
(
remapWeightsFile
,
gridID1
,
gridID2
,
remap
,
extrapolateIsSet
,
remapExtrapolate
);
if
(
numRemaps
==
0
)
{
operfunc
=
maptype_to_operfunc
(
remapSwitches
);
}
else
if
(
operfunc
!=
maptype_to_operfunc
(
remapSwitches
))
{
cdo_abort
(
"Remapping method changed in input weights files!"
);
}
numRemaps
++
;
}
}
else
{
...
...
@@ -662,7 +677,7 @@ public:
}
if
(
doRemap
&&
remap_genweights
&&
remaps
[
0
].
nused
==
0
)
remap_print_warning
(
remapWeightsFile
,
operfunc
,
remaps
[
0
].
srcGrid
,
remaps
[
0
].
nmiss
);
remap_print_warning
(
remapWeightsFile
s
[
0
]
,
operfunc
,
remaps
[
0
].
srcGrid
,
remaps
[
0
].
nmiss
);
for
(
int
remapIndex
=
0
;
remapIndex
<
numRemaps
;
remapIndex
++
)
{
...
...
This diff is collapsed.
Click to expand it.
src/Remapweights.cc
+
10
−
0
View file @
a1367ce7
...
...
@@ -165,6 +165,7 @@ public:
int
tsID
=
0
;
auto
nrecs
=
cdo_stream_inq_timestep
(
streamID1
,
tsID
);
int
gridIDout
=
-
1
;
for
(
int
recID
=
0
;
recID
<
nrecs
;
++
recID
)
{
int
varID
,
levelID
;
...
...
@@ -178,6 +179,15 @@ public:
if
(
remapGrids
[
gridIndex
])
{
if
(
numRemaps
==
0
)
{
gridIDout
=
var
.
gridID
;
}
else
if
(
gridIDout
!=
var
.
gridID
)
{
continue
;
}
if
(
mapType
!=
RemapMethod
::
CONSERV_SCRIP
&&
mapType
!=
RemapMethod
::
CONSERV
&&
var
.
gridType
==
GRID_GME
)
cdo_abort
(
"Only conservative remapping is available to remap between GME grids!"
);
...
...
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