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
12363d73
Commit
12363d73
authored
Jul 23, 2015
by
Uwe Schulzweida
Browse files
changed option --history to --no_history
parent
4bd1dd40
Changes
8
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
12363d73
...
...
@@ -3,6 +3,10 @@
* using CDI library version 1.7.0
* Version 1.7.0 released
2015-07-23 Uwe Schulzweida
* changed option --history to --no_history
2015-07-21 Uwe Schulzweida
* tinfo: optimize calculation of monthly and yearly increment
...
...
doc/cdo_refcard.pdf
View file @
12363d73
No preview for this file type
doc/tex/usage.tex
View file @
12363d73
...
...
@@ -61,7 +61,7 @@ The following options are available for all operators:
\>
Available grid names are:
{
\tt
r<NX>x<NY>
}
,
{
\tt
lon=<LON>/lat=<LAT>
}
,
{
\tt
n<N>
}
,
{
\tt
gme<NI>
}
\\
\makebox
[1.5in][l]
{
\hspace*
{
1cm
}
\sl
-h, -
\,
-help
}
\>
Help information for the operators.
\\
\makebox
[1.5in][l]
{
\hspace*
{
1cm
}
\sl
-
\,
-history
}
\makebox
[1.5in][l]
{
\hspace*
{
1cm
}
\sl
-
\,
-
no
\_
history
}
\>
Do not append to netCDF
{
\it
history
}
global attribute.
\\
\makebox
[1.5in][l]
{
\hspace*
{
1cm
}
\sl
-
\,
-netcdf
\_
hdr
\_
pad, -
\,
-hdr
\_
pad, -
\,
-header
\_
pad
$
<
$
nbr
$
>
$}
\>
\\
...
...
src/Vertcum.c
View file @
12363d73
...
...
@@ -72,10 +72,10 @@ void *Vertcum(void *argument)
cdoInitialize
(
argument
);
int
VERTCUM
=
cdoOperatorAdd
(
"vertcum"
,
0
,
0
,
NULL
);
cdoOperatorAdd
(
"vertcum"
,
0
,
0
,
NULL
);
int
VERTCUMHL
=
cdoOperatorAdd
(
"vertcumhl"
,
0
,
0
,
NULL
);
int
operatorID
=
cdoOperatorID
();
int
operatorID
=
cdoOperatorID
();
int
streamID1
=
streamOpenRead
(
cdoStreamName
(
0
));
...
...
@@ -83,7 +83,6 @@ void *Vertcum(void *argument)
int
vlistID2
=
vlistDuplicate
(
vlistID1
);
int
nvars
=
vlistNvars
(
vlistID1
);
int
vars
[
nvars
];
int
*
varnmiss
[
nvars
];
double
**
vardata1
[
nvars
];
double
**
vardata2
[
nvars
];
...
...
@@ -234,8 +233,8 @@ void *Vertcum(void *argument)
for
(
varID
=
0
;
varID
<
nvars
;
++
varID
)
{
nlevs
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID1
,
varID
));
nlevs2
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID2
,
varID
));
nlevs
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID1
,
varID
));
nlevs2
=
zaxisInqSize
(
vlistInqVarZaxis
(
vlistID2
,
varID
));
for
(
levelID
=
0
;
levelID
<
nlevs
;
++
levelID
)
free
(
vardata1
[
varID
][
levelID
]);
for
(
levelID
=
0
;
levelID
<
nlevs2
;
++
levelID
)
free
(
vardata2
[
varID
][
levelID
]);
free
(
vardata1
[
varID
]);
...
...
src/cdo.c
View file @
12363d73
...
...
@@ -996,17 +996,18 @@ int parse_options_long(int argc, char *argv[])
struct
cdo_option
opt_long
[]
=
{
{
"netcdf_hdr_pad"
,
required_argument
,
&
lnetcdf_hdr_pad
,
1
},
{
"header_pad"
,
required_argument
,
&
lnetcdf_hdr_pad
,
1
},
{
"hdr_pad"
,
required_argument
,
&
lnetcdf_hdr_pad
,
1
},
{
"use_fftw"
,
required_argument
,
&
luse_fftw
,
1
},
{
"remap_genweights"
,
required_argument
,
&
lremap_genweights
,
1
},
{
"reduce_dim"
,
no_argument
,
&
CDO_Reduce_Dim
,
1
},
{
"rusage"
,
no_argument
,
&
CDO_Rusage
,
1
},
{
"no_warnings"
,
no_argument
,
&
_Verbose
,
0
},
{
"netcdf_hdr_pad"
,
required_argument
,
&
lnetcdf_hdr_pad
,
1
},
{
"header_pad"
,
required_argument
,
&
lnetcdf_hdr_pad
,
1
},
{
"hdr_pad"
,
required_argument
,
&
lnetcdf_hdr_pad
,
1
},
{
"use_fftw"
,
required_argument
,
&
luse_fftw
,
1
},
{
"remap_genweights"
,
required_argument
,
&
lremap_genweights
,
1
},
{
"reduce_dim"
,
no_argument
,
&
CDO_Reduce_Dim
,
1
},
{
"rusage"
,
no_argument
,
&
CDO_Rusage
,
1
},
{
"no_warnings"
,
no_argument
,
&
_Verbose
,
0
},
{
"format"
,
required_argument
,
NULL
,
'f'
},
{
"help"
,
no_argument
,
NULL
,
'h'
},
{
"history"
,
no_argument
,
NULL
,
'H'
},
{
"history"
,
no_argument
,
&
CDO_Append_History
,
0
},
{
"no_history"
,
no_argument
,
&
CDO_Append_History
,
0
},
{
"regular"
,
no_argument
,
NULL
,
'R'
},
{
"silent"
,
no_argument
,
NULL
,
's'
},
{
"table"
,
required_argument
,
NULL
,
't'
},
...
...
@@ -1023,7 +1024,7 @@ int parse_options_long(int argc, char *argv[])
luse_fftw
=
0
;
lremap_genweights
=
0
;
c
=
cdo_getopt_long
(
argc
,
argv
,
"f:b:e:P:p:g:i:k:l:m:n:t:D:z:aBCcdh
H
LMOQRrsSTuVvWXZ"
,
opt_long
,
NULL
);
c
=
cdo_getopt_long
(
argc
,
argv
,
"f:b:e:P:p:g:i:k:l:m:n:t:D:z:aBCcdhLMOQRrsSTuVvWXZ"
,
opt_long
,
NULL
);
if
(
c
==
-
1
)
break
;
switch
(
c
)
...
...
@@ -1104,9 +1105,6 @@ int parse_options_long(int argc, char *argv[])
case
'h'
:
Help
=
1
;
break
;
case
'H'
:
CDO_Append_History
=
FALSE
;
break
;
case
'i'
:
defineInstitution
(
CDO_optarg
);
break
;
...
...
src/grid_search.c
View file @
12363d73
...
...
@@ -186,6 +186,35 @@ void *gridsearch_nearest(struct gridsearch *gs, double lon, double lat, double *
}
struct
pqueue
*
gridsearch_qnearest
(
struct
gridsearch
*
gs
,
double
lon
,
double
lat
,
double
*
prange
,
unsigned
nnn
)
{
if
(
gs
->
kdt
==
NULL
)
return
NULL
;
float
point
[
3
];
float
range0
;
if
(
prange
)
range0
=
*
prange
;
else
range0
=
SQR
(
2
*
M_PI
);
/* This has to be bigger than the presumed
* maximum distance to the NN but smaller
* than once around the sphere. The content
* of this variable is replaced with the
* distance to the NN squared. */
float
range
=
range0
;
LLtoXYZ_f
(
lon
,
lat
,
point
);
struct
pqueue
*
result
=
kd_qnearest
(
gs
->
kdt
,
point
,
&
range
,
nnn
,
3
);
// printf("range %g %g %g %p\n", lon, lat, range, node);
if
(
!
(
range
<
range0
)
)
result
=
NULL
;
if
(
prange
)
*
prange
=
range
;
return
result
;
}
unsigned
gridsearch_item
(
void
*
gs_result
)
{
unsigned
index
=
0
;
...
...
src/grid_search.h
View file @
12363d73
#ifndef _GRID_SEARCH_H_
#define _GRID_SEARCH_H_
#include
"kdtreelib/kdtree.h"
struct
gridsearch
;
struct
gridsearch
*
gridsearch_create
(
unsigned
n
,
const
double
*
restrict
lons
,
const
double
*
restrict
lats
);
...
...
@@ -8,5 +10,6 @@ struct gridsearch *gridsearch_index_create(unsigned n, const double *restrict lo
void
gridsearch_delete
(
struct
gridsearch
*
gs
);
void
*
gridsearch_nearest
(
struct
gridsearch
*
gs
,
double
lon
,
double
lat
,
double
*
range
);
unsigned
gridsearch_item
(
void
*
gs_result
);
struct
pqueue
*
gridsearch_qnearest
(
struct
gridsearch
*
gs
,
double
lon
,
double
lat
,
double
*
prange
,
unsigned
nnn
);
#endif
src/remap_distwgt_scrip.c
View file @
12363d73
...
...
@@ -376,7 +376,7 @@ void grid_search_nbr_new(struct gridsearch *gs, int num_neighbors, int *restrict
for
(
n
=
0
;
n
<
num_neighbors
;
++
n
)
nbr_add
[
n
]
=
-
1
;
for
(
n
=
0
;
n
<
num_neighbors
;
++
n
)
nbr_dist
[
n
]
=
BIGNUM
;
int
ndist
=
1
;
int
ndist
=
num_neighbors
;
double
distance
;
/* Angular distance */
double
*
dist
=
(
double
*
)
malloc
(
ndist
*
sizeof
(
double
));
int
*
adds
=
(
int
*
)
malloc
(
ndist
*
sizeof
(
int
));
...
...
@@ -384,24 +384,39 @@ void grid_search_nbr_new(struct gridsearch *gs, int num_neighbors, int *restrict
double
range
=
SQR
(
2
*
search_radius
);
int
j
=
0
;
void
*
gs_result
=
gridsearch_nearest
(
gs
,
plon
,
plat
,
&
range
);
// void *gs_result = gridsearch_nearest(gs, plon, plat, &range);
struct
pqueue
*
gs_result
=
gridsearch_qnearest
(
gs
,
plon
,
plat
,
&
range
,
num_neighbors
);
if
(
gs_result
)
{
unsigned
nadd
=
gridsearch_item
(
gs_result
);
unsigned
nadd
;
struct
resItem
*
p
;
while
(
pqremove_min
(
gs_result
,
&
p
)
)
{
// fprintf(stdout, " index : %d\tdist: %g\n", p->node->index, p->dist_sq);
nadd
=
p
->
node
->
index
;
distance
=
sinlat_dst
*
sinlat
[
nadd
]
+
coslat_dst
*
coslat
[
nadd
]
*
(
coslon_dst
*
coslon
[
nadd
]
+
sinlon_dst
*
sinlon
[
nadd
]);
if
(
distance
>
1
.
)
distance
=
1
.;
distance
=
sinlat_dst
*
sinlat
[
nadd
]
+
coslat_dst
*
coslat
[
nadd
]
*
(
coslon_dst
*
coslon
[
nadd
]
+
sinlon_dst
*
sinlon
[
nadd
]);
if
(
distance
>
1
.
)
distance
=
1
.;
printf
(
"j: %d nadd %d dist %g search_radius %g acosdis %g sqrtrange %g
\n
"
,
j
+
1
,
nadd
,
distance
,
search_radius
,
acos
(
distance
),
sqrt
(
p
->
dist_sq
));
if
(
distance
>=
cos_search_radius
)
{
dist
[
j
]
=
distance
;
adds
[
j
]
=
nadd
;
j
++
;
}
/* Free the result node taken from the heap */
free
(
p
);
}
// printf("nadd %d dist %g search_radius %g acosdis %g sqrtrange %g\n", nadd, distance, search_radius, acos(distance), sqrt(range));
if
(
distance
>=
cos_search_radius
)
{
dist
[
j
]
=
distance
;
adds
[
j
]
=
nadd
;
j
++
;
}
/* free the heap */
free
(
gs_result
->
d
);
/* and free the heap information structure */
free
(
gs_result
);
}
ndist
=
j
;
#if defined(HAVE_OPENMP4)
...
...
@@ -678,7 +693,7 @@ void scrip_remap_distwgt(int num_neighbors, remapgrid_t *src_grid, remapgrid_t *
double
nbr_dist
[
num_neighbors
];
/* angular distance four nearest neighbors */
struct
gridsearch
*
gs
=
NULL
;
if
(
remap_grid_type
!=
REMAP_GRID_TYPE_REG2D
&&
num_neighbors
==
1
)
if
(
remap_grid_type
!=
REMAP_GRID_TYPE_REG2D
&&
num_neighbors
<
5
)
{
gs
=
gridsearch_create
(
src_grid_size
,
src_grid
->
cell_center_lon
,
src_grid
->
cell_center_lat
);
}
...
...
@@ -724,7 +739,7 @@ void scrip_remap_distwgt(int num_neighbors, remapgrid_t *src_grid, remapgrid_t *
src_grid
->
reg2d_center_lat
,
src_grid
->
reg2d_center_lon
);
else
{
if
(
num_neighbors
==
1
)
if
(
num_neighbors
<
5
)
grid_search_nbr_new
(
gs
,
num_neighbors
,
nbr_add
,
nbr_dist
,
plat
,
plon
,
sinlat
,
coslat
,
sinlon
,
coslon
);
else
...
...
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