Skip to content
GitLab
Menu
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
c75a5c28
Commit
c75a5c28
authored
Mar 14, 2014
by
Uwe Schulzweida
Browse files
remapcon: check for missing values in normalisation
parent
664fb2ce
Changes
7
Hide whitespace changes
Inline
Side-by-side
.gitattributes
View file @
c75a5c28
...
...
@@ -47,6 +47,7 @@ doc/Doxyfile -text
doc/cdo-poster.pdf -text
doc/cdo.pdf -text
doc/cdoBrochureWeb.pdf -text svneol=unset#unset
doc/cdo_limits -text
doc/cdo_refcard.pdf -text
doc/cdo_spectralnudgingdata.pdf -text
doc/eca_operator.pdf -text
...
...
ChangeLog
View file @
c75a5c28
...
...
@@ -3,6 +3,10 @@
* using CDI library version 1.6.4
* Version 1.6.4 released
2014-03-14 Uwe Schulzweida
* remapcon: check for missing values in normalisation
2014-03-10 Uwe Schulzweida
* added Option -H to do not append to netCDF "history" global attribute
...
...
doc/cdo_limits
0 → 100644
View file @
c75a5c28
32-bit integer:
date YYYYMMDD -> -214748 < year < 214748
gridsize -> max: 2147483647, 65455x32727
src/Remap.c
View file @
c75a5c28
...
...
@@ -989,7 +989,7 @@ void *Remap(void *argument)
gridsize2
=
gridInqSize
(
gridID2
);
/* used only to check the result of remapcon */
if
(
operfunc
==
REMAPCON
||
operfunc
==
REMAPCON2
||
operfunc
==
REMAPCONS
)
if
(
operfunc
==
REMAPCON
||
operfunc
==
REMAPCON2
||
operfunc
==
REMAPCONS
)
{
double
grid2_err
;
...
...
@@ -997,21 +997,27 @@ void *Remap(void *argument)
{
for
(
i
=
0
;
i
<
gridsize2
;
i
++
)
{
grid2_err
=
remaps
[
r
].
tgt_grid
.
cell_frac
[
i
]
*
remaps
[
r
].
tgt_grid
.
cell_area
[
i
];
if
(
fabs
(
grid2_err
)
>
0
)
array2
[
i
]
=
array2
[
i
]
/
grid2_err
;
else
array2
[
i
]
=
missval
;
if
(
!
DBL_IS_EQUAL
(
array2
[
i
],
missval
)
)
{
grid2_err
=
remaps
[
r
].
tgt_grid
.
cell_frac
[
i
]
*
remaps
[
r
].
tgt_grid
.
cell_area
[
i
];
if
(
fabs
(
grid2_err
)
>
0
)
array2
[
i
]
=
array2
[
i
]
/
grid2_err
;
else
array2
[
i
]
=
missval
;
}
}
}
else
if
(
remaps
[
r
].
vars
.
norm_opt
==
NORM_OPT_DESTAREA
)
{
for
(
i
=
0
;
i
<
gridsize2
;
i
++
)
{
if
(
fabs
(
remaps
[
r
].
tgt_grid
.
cell_frac
[
i
])
>
0
)
array2
[
i
]
=
array2
[
i
]
/
remaps
[
r
].
tgt_grid
.
cell_frac
[
i
];
else
array2
[
i
]
=
missval
;
if
(
!
DBL_IS_EQUAL
(
array2
[
i
],
missval
)
)
{
if
(
fabs
(
remaps
[
r
].
tgt_grid
.
cell_frac
[
i
])
>
0
)
array2
[
i
]
=
array2
[
i
]
/
remaps
[
r
].
tgt_grid
.
cell_frac
[
i
];
else
array2
[
i
]
=
missval
;
}
}
}
...
...
src/cdo_int.h
View file @
c75a5c28
...
...
@@ -51,6 +51,8 @@ char *strdup(const char *s);
*/
#endif
#define strcompare(s1, s2) (strncmp(s1, s2, strlen(s2)))
/* sxxxYYYYMMDDhhmm0 */
#define DATE_LEN 31
/* YYYYMMDDhhmmss allocate DTLEN+1 !!!! */
...
...
src/remap_scrip_io.c
View file @
c75a5c28
...
...
@@ -474,6 +474,8 @@ void read_remap_scrip(const char *interp_file, int gridID1, int gridID2, int *ma
nce
(
nc_inq_attlen
(
nc_file_id
,
NC_GLOBAL
,
"normalization"
,
&
attlen
));
normalize_opt
[
attlen
]
=
0
;
rv
->
sort_add
=
FALSE
;
if
(
strcmp
(
normalize_opt
,
"none"
)
==
0
)
rv
->
norm_opt
=
NORM_OPT_NONE
;
else
if
(
strcmp
(
normalize_opt
,
"fracarea"
)
==
0
)
...
...
@@ -498,10 +500,10 @@ void read_remap_scrip(const char *interp_file, int gridID1, int gridID2, int *ma
*
submap_type
=
SUBMAP_TYPE_NONE
;
*
remap_order
=
1
;
if
(
memcmp
(
map_method
,
"Conservative"
,
12
)
==
0
)
if
(
strcompare
(
map_method
,
"Conservative"
)
==
0
)
{
int
iatt
;
if
(
memcmp
(
map_method
,
"Conservative remapping using clipping on sphere"
,
47
)
==
0
)
if
(
strcompare
(
map_method
,
"Conservative remapping using clipping on sphere"
)
==
0
)
rv
->
map_type
=
MAP_TYPE_CONSPHERE
;
else
rv
->
map_type
=
MAP_TYPE_CONSERV
;
...
...
@@ -509,19 +511,19 @@ void read_remap_scrip(const char *interp_file, int gridID1, int gridID2, int *ma
status
=
nc_get_att_int
(
nc_file_id
,
NC_GLOBAL
,
"remap_order"
,
&
iatt
);
if
(
status
==
NC_NOERR
)
*
remap_order
=
iatt
;
}
else
if
(
memcmp
(
map_method
,
"Bilinear"
,
8
)
==
0
)
rv
->
map_type
=
MAP_TYPE_BILINEAR
;
else
if
(
memcmp
(
map_method
,
"Bicubic"
,
7
)
==
0
)
rv
->
map_type
=
MAP_TYPE_BICUBIC
;
else
if
(
memcmp
(
map_method
,
"Distance"
,
8
)
==
0
)
else
if
(
strcompare
(
map_method
,
"Bilinear"
)
==
0
)
rv
->
map_type
=
MAP_TYPE_BILINEAR
;
else
if
(
strcompare
(
map_method
,
"Bicubic"
)
==
0
)
rv
->
map_type
=
MAP_TYPE_BICUBIC
;
else
if
(
strcompare
(
map_method
,
"Distance"
)
==
0
)
{
rv
->
map_type
=
MAP_TYPE_DISTWGT
;
*
num_neighbors
=
4
;
}
else
if
(
memcmp
(
map_method
,
"Nearest"
,
7
)
==
0
)
else
if
(
strcompare
(
map_method
,
"Nearest"
)
==
0
)
{
rv
->
map_type
=
MAP_TYPE_DISTWGT
;
*
num_neighbors
=
1
;
}
else
if
(
memcmp
(
map_method
,
"Largest"
,
7
)
==
0
)
else
if
(
strcompare
(
map_method
,
"Largest"
)
==
0
)
{
rv
->
map_type
=
MAP_TYPE_CONSERV
;
*
submap_type
=
SUBMAP_TYPE_LAF
;
...
...
src/remaplib.c
View file @
c75a5c28
...
...
@@ -5813,11 +5813,19 @@ void remap_consphere(remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapvars_t *
//printf("target: %ld\n", tgt_grid_add);
if
(
lyac
)
// if ( tgt_grid_add == 682 )
for
(
int
n
=
0
;
n
<
tgt_num_cell_corners
;
++
n
)
if
(
tgt_grid_add
==
174752
)
{
printf
(
" TargetCell.coordinates_x[%d] = %g*rad;
\n
"
,
n
,
tgt_grid_cell
->
coordinates_x
[
n
]
/
DEG2RAD
);
printf
(
" TargetCell.coordinates_y[%d] = %g*rad;
\n
"
,
n
,
tgt_grid_cell
->
coordinates_y
[
n
]
/
DEG2RAD
);
for
(
int
n
=
0
;
n
<
tgt_num_cell_corners
;
++
n
)
{
printf
(
" TargetCell.coordinates_x[%d] = %g*rad;
\n
"
,
n
,
tgt_grid_cell
->
coordinates_x
[
n
]
/
DEG2RAD
);
printf
(
" TargetCell.coordinates_y[%d] = %g*rad;
\n
"
,
n
,
tgt_grid_cell
->
coordinates_y
[
n
]
/
DEG2RAD
);
}
/*
printf("> -Z1\n");
for ( int n = 0; n < tgt_num_cell_corners; ++n )
printf(" %g %g\n", tgt_grid_cell->coordinates_x[n]/DEG2RAD, tgt_grid_cell->coordinates_y[n]/DEG2RAD);
printf(" %g %g\n", tgt_grid_cell->coordinates_x[0]/DEG2RAD, tgt_grid_cell->coordinates_y[0]/DEG2RAD);
*/
}
/* Create search arrays */
...
...
@@ -5913,15 +5921,21 @@ void remap_consphere(remapgrid_t *src_grid, remapgrid_t *tgt_grid, remapvars_t *
LLtoXYZ
(
src_grid_cells
[
n
].
coordinates_x
[
ic
],
src_grid_cells
[
n
].
coordinates_y
[
ic
],
src_grid_cells
[
n
].
coordinates_xyz
+
ic
*
3
);
if
(
lyac
)
//
if ( tgt_grid_add ==
68
2 )
if
(
tgt_grid_add
==
17475
2
)
{
printf
(
"n %d
\n
"
,
(
int
)
n
);
//
printf("n %d\n", (int)n);
for
(
k
=
0
;
k
<
srch_corners
;
++
k
)
{
printf
(
" SourceCell[ii].coordinates_x[%ld] = %g*rad;
\n
"
,
k
,
src_grid_cells
[
n
].
coordinates_x
[
k
]
/
DEG2RAD
);
printf
(
" SourceCell[ii].coordinates_y[%ld] = %g*rad;
\n
"
,
k
,
src_grid_cells
[
n
].
coordinates_y
[
k
]
/
DEG2RAD
);
}
printf
(
" ii++;
\n
"
);
/*
printf("> -Z1\n");
for ( k = 0; k < srch_corners; ++k )
printf(" %g %g\n", src_grid_cells[n].coordinates_x[k]/DEG2RAD, src_grid_cells[n].coordinates_y[k]/DEG2RAD);
printf(" %g %g\n", src_grid_cells[n].coordinates_x[0]/DEG2RAD, src_grid_cells[n].coordinates_y[0]/DEG2RAD);
*/
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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