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
83e92d36
Commit
83e92d36
authored
Nov 05, 2006
by
Uwe Schulzweida
Browse files
pctl cleanup
parent
4e6bcb25
Changes
15
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
83e92d36
2006-11-?? Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* processSelf: lock/unlock NumProcess (bug fix)
* Version 1.0.4 released
2006-11-02 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
...
...
src/Runpctl.c
View file @
83e92d36
...
...
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C)
2003-
2006 Brockmann Consult
Copyright (C) 2006 Brockmann Consult
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
...
...
@@ -34,13 +34,6 @@
#include
"dmemory.h"
#include
"nth_element.h"
typedef
struct
{
int
date
;
int
time
;
int
julval
;
}
DATETIME
;
void
*
Runpctl
(
void
*
argument
)
{
...
...
@@ -179,7 +172,7 @@ void *Runpctl(void *argument)
if
(
j
>
0
)
{
vars1
[
0
][
varID
][
levelID
].
ptr
[
i
]
=
nth_element
(
array
,
j
,
ceil
(
j
*
(
pn
/
100
.
0
))
-
1
);
vars1
[
0
][
varID
][
levelID
].
ptr
[
i
]
=
nth_element
(
array
,
j
,
(
int
)
ceil
(
j
*
(
pn
/
100
.
0
))
-
1
);
}
else
{
...
...
src/Runstat.c
View file @
83e92d36
...
...
@@ -40,14 +40,6 @@
#include
"dmemory.h"
typedef
struct
{
int
date
;
int
time
;
int
julval
;
}
DATETIME
;
void
datetime_avg
(
int
dpy
,
int
ndates
,
DATETIME
*
datetime
)
{
int
vdate
,
vtime
;
...
...
src/Seaspctl.c
View file @
83e92d36
...
...
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C)
2003-
2006 Brockmann Consult
Copyright (C) 2006 Brockmann Consult
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
...
...
@@ -43,7 +43,6 @@ void *Seaspctl(void *argument)
int
tsID
;
int
otsID
;
long
nsets
;
int
i
;
int
year
,
month
,
seas
,
seas0
=
0
;
int
streamID1
,
streamID2
,
streamID3
,
streamID4
;
int
vlistID1
,
vlistID2
,
vlistID3
,
vlistID4
,
taxisID1
,
taxisID2
,
taxisID3
,
taxisID4
;
...
...
src/Selpctl.c
View file @
83e92d36
...
...
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C)
2003-
2006 Brockmann Consult
Copyright (C) 2006 Brockmann Consult
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
...
...
@@ -42,7 +42,7 @@ void *Selpctl(void *argument)
int
gridID
,
varID
,
levelID
,
recID
;
int
tsID
;
int
otsID
;
int
nsets
;
int
nsets
=
0
;
int
i
;
int
streamID1
,
streamID2
,
streamID3
,
streamID4
;
int
vlistID1
,
vlistID2
,
vlistID3
,
vlistID4
,
taxisID1
,
taxisID2
,
taxisID3
,
taxisID4
;
...
...
src/Timpctl.c
View file @
83e92d36
...
...
@@ -49,7 +49,6 @@ static void timpctl(int operatorID)
int
tsID
;
int
otsID
;
long
nsets
;
int
i
;
int
streamID1
,
streamID2
,
streamID3
,
streamID4
;
int
vlistID1
,
vlistID2
,
vlistID3
,
vlistID4
,
taxisID1
,
taxisID2
,
taxisID3
,
taxisID4
;
int
nmiss
;
...
...
@@ -255,7 +254,6 @@ static void timpctl(int operatorID)
void
*
Timpctl
(
void
*
argument
)
{
static
const
char
func
[]
=
"Timpctl"
;
int
operatorID
;
cdoInitialize
(
argument
);
...
...
@@ -269,6 +267,7 @@ void *Timpctl(void *argument)
operatorID
=
cdoOperatorID
();
timpctl
(
operatorID
);
cdoFinish
();
return
(
0
);
...
...
src/Ydaypctl.c
View file @
83e92d36
...
...
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C)
2003-
2006 Brockmann Consult
Copyright (C) 2006 Brockmann Consult
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
...
...
@@ -117,7 +117,7 @@ void *Ydaypctl(void *argument)
field
.
ptr
=
(
double
*
)
malloc
(
gridsize
*
sizeof
(
double
));
tsID
=
0
;
while
(
nrecs
=
streamInqTimestep
(
streamID2
,
tsID
)
)
while
(
(
nrecs
=
streamInqTimestep
(
streamID2
,
tsID
)
)
)
{
if
(
nrecs
!=
streamInqTimestep
(
streamID3
,
tsID
)
)
cdoAbort
(
"Number of records in time step %d of %s and %s are different!"
,
tsID
+
1
,
cdoStreamName
(
1
),
cdoStreamName
(
2
));
...
...
@@ -191,7 +191,7 @@ void *Ydaypctl(void *argument)
}
tsID
=
0
;
while
(
nrecs
=
streamInqTimestep
(
streamID1
,
tsID
)
)
while
(
(
nrecs
=
streamInqTimestep
(
streamID1
,
tsID
)
)
)
{
vdate
=
taxisInqVdate
(
taxisID1
);
vtime
=
taxisInqVtime
(
taxisID1
);
...
...
src/Ydrunpctl.c
View file @
83e92d36
...
...
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C)
2003-
2006 Brockmann Consult
Copyright (C) 2006 Brockmann Consult
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
...
...
@@ -39,14 +39,6 @@
#define NDAY 373
typedef
struct
{
int
date
;
int
time
;
int
julval
;
}
DATETIME
;
void
*
Ydrunpctl
(
void
*
argument
)
{
static
char
func
[]
=
"Ydrunpctl"
;
...
...
@@ -164,7 +156,7 @@ void *Ydrunpctl(void *argument)
}
tsID
=
0
;
while
(
nrecs
=
streamInqTimestep
(
streamID2
,
tsID
)
)
while
(
(
nrecs
=
streamInqTimestep
(
streamID2
,
tsID
)
)
)
{
if
(
nrecs
!=
streamInqTimestep
(
streamID3
,
tsID
)
)
cdoAbort
(
"Number of records in time step %d of %s and %s are different!"
,
tsID
+
1
,
cdoStreamName
(
1
),
cdoStreamName
(
2
));
...
...
src/Ydrunstat.c
View file @
83e92d36
...
...
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C)
2003-
2006 Brockmann Consult
Copyright (C) 2006 Brockmann Consult
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
...
...
@@ -43,14 +43,6 @@
#define NDAY 373
typedef
struct
{
int
date
;
int
time
;
int
julval
;
}
DATETIME
;
typedef
struct
{
int
vdate
[
NDAY
];
int
vtime
[
NDAY
];
...
...
@@ -398,7 +390,8 @@ static void ydstatCreateVars1(YDAY_STATS *stats, int dayoy)
{
static
const
char
func
[]
=
"ydstatCreateVars1"
;
int
varID
,
levelID
,
nvars
,
nlevels
;
int
gridID
,
gridsize
,
missval
;
int
gridID
,
gridsize
;
double
missval
;
nvars
=
vlistNvars
(
stats
->
vlist
);
...
...
@@ -427,7 +420,8 @@ static void ydstatCreateVars2(YDAY_STATS *stats, int dayoy)
{
static
const
char
func
[]
=
"ydstatCreateVars2"
;
int
varID
,
levelID
,
nvars
,
nlevels
;
int
gridID
,
gridsize
,
missval
;
int
gridID
,
gridsize
;
double
missval
;
nvars
=
vlistNvars
(
stats
->
vlist
);
...
...
@@ -455,9 +449,8 @@ static void ydstatCreateVars2(YDAY_STATS *stats, int dayoy)
static
void
ydstatUpdate
(
YDAY_STATS
*
stats
,
int
vdate
,
int
vtime
,
FIELD
**
vars1
,
FIELD
**
vars2
,
int
nsets
,
int
operfunc
)
{
static
char
func
[]
=
"ydstatUpdate"
;
int
varID
,
levelID
,
nvars
,
nlevels
;
int
gridID
,
gridsize
;
int
gridsize
;
int
year
,
month
,
day
,
dayoy
;
nvars
=
vlistNvars
(
stats
->
vlist
);
...
...
src/Ymonpctl.c
View file @
83e92d36
...
...
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C)
2003-
2006 Brockmann Consult
Copyright (C) 2006 Brockmann Consult
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
...
...
@@ -116,7 +116,7 @@ void *Ymonpctl(void *argument)
field
.
ptr
=
(
double
*
)
malloc
(
gridsize
*
sizeof
(
double
));
tsID
=
0
;
while
(
nrecs
=
streamInqTimestep
(
streamID2
,
tsID
)
)
while
(
(
nrecs
=
streamInqTimestep
(
streamID2
,
tsID
)
)
)
{
if
(
nrecs
!=
streamInqTimestep
(
streamID3
,
tsID
)
)
cdoAbort
(
"Number of records in time step %d of %s and %s are different!"
,
tsID
+
1
,
cdoStreamName
(
1
),
cdoStreamName
(
2
));
...
...
@@ -183,7 +183,7 @@ void *Ymonpctl(void *argument)
}
tsID
=
0
;
while
(
nrecs
=
streamInqTimestep
(
streamID1
,
tsID
)
)
while
(
(
nrecs
=
streamInqTimestep
(
streamID1
,
tsID
)
)
)
{
vdate
=
taxisInqVdate
(
taxisID1
);
vtime
=
taxisInqVtime
(
taxisID1
);
...
...
src/Yseaspctl.c
View file @
83e92d36
...
...
@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C)
2003-
2006 Brockmann Consult
Copyright (C) 2006 Brockmann Consult
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
...
...
@@ -38,8 +38,6 @@
void
*
Yseaspctl
(
void
*
argument
)
{
static
char
func
[]
=
"Yseaspctl"
;
int
operatorID
;
int
operfunc
;
int
gridsize
;
int
varID
;
int
recID
;
...
...
@@ -118,7 +116,7 @@ void *Yseaspctl(void *argument)
field
.
ptr
=
(
double
*
)
malloc
(
gridsize
*
sizeof
(
double
));
tsID
=
0
;
while
(
nrecs
=
streamInqTimestep
(
streamID2
,
tsID
)
)
while
(
(
nrecs
=
streamInqTimestep
(
streamID2
,
tsID
)
)
)
{
if
(
nrecs
!=
streamInqTimestep
(
streamID3
,
tsID
)
)
cdoAbort
(
"Number of records in time step %d of %s and %s are different!"
,
tsID
+
1
,
cdoStreamName
(
1
),
cdoStreamName
(
2
));
...
...
@@ -192,7 +190,7 @@ void *Yseaspctl(void *argument)
}
tsID
=
0
;
while
(
nrecs
=
streamInqTimestep
(
streamID1
,
tsID
)
)
while
(
(
nrecs
=
streamInqTimestep
(
streamID1
,
tsID
)
)
)
{
vdate
=
taxisInqVdate
(
taxisID1
);
vtime
=
taxisInqVtime
(
taxisID1
);
...
...
src/cdo_int.h
View file @
83e92d36
...
...
@@ -92,6 +92,15 @@ int ntr2nlat(int ntr);
int
ntr2nlat_linear
(
int
ntr
);
int
compNlon
(
int
nlat
);
typedef
struct
{
int
date
;
int
time
;
int
julval
;
}
DATETIME
;
void
datetime_avg
(
int
dpy
,
int
ndates
,
DATETIME
*
datetime
);
void
decode_date
(
int
date
,
int
*
year
,
int
*
month
,
int
*
day
);
void
decode_time
(
int
time
,
int
*
hour
,
int
*
minute
);
double
encode_julval
(
int
dpy
,
int
date
,
int
time
);
...
...
src/modules.c
View file @
83e92d36
...
...
@@ -420,8 +420,8 @@ static MODULES Modules[] =
/* QR */
{
Ydaystat
,
YdaystatHelp
,
YdaystatOperators
,
1
,
1
},
/* RQ */
{
Ydrunpctl
,
Ydrunpctl
,
YdrunpctlOperators
,
3
,
1
},
{
Ydrunstat
,
Ydrunstat
,
YdrunstatOperators
,
1
,
1
},
{
Ydrunpctl
,
Ydrunpctl
Help
,
YdrunpctlOperators
,
3
,
1
},
{
Ydrunstat
,
Ydrunstat
Help
,
YdrunstatOperators
,
1
,
1
},
/* QR */
{
Ymonarith
,
YmonarithHelp
,
YmonarithOperators
,
2
,
1
},
/* RQ */
...
...
src/percentiles.c
View file @
83e92d36
...
...
@@ -18,6 +18,8 @@
#include
<assert.h>
#include
<stdlib.h>
#include
<math.h>
#include
"cdi.h"
#include
"cdo.h"
#include
"cdo_int.h"
#include
"nth_element.h"
...
...
@@ -146,7 +148,7 @@ static double histGetPercentile(const HISTOGRAM *hist, int p)
}
else
{
return
nth_element
(
DBL_PTR
(
hist
->
ptr
),
hist
->
nsamp
,
ceil
(
s
)
-
1
);
return
(
double
)
nth_element
(
DBL_PTR
(
hist
->
ptr
),
hist
->
nsamp
,
ceil
(
s
)
-
1
);
}
}
...
...
@@ -182,7 +184,7 @@ HISTOGRAM_SET *hsetCreate(int nvars)
void
hsetCreateVarLevels
(
HISTOGRAM_SET
*
hset
,
int
varID
,
int
nlevels
,
int
grid
)
{
static
const
char
func
[]
=
"hsetCreateVarLevels"
;
int
i
,
nvars
,
nhists
,
nbins
,
levelID
,
histID
;
int
nvars
,
nhists
,
nbins
,
levelID
,
histID
;
HISTOGRAM
*
hists
;
nbins
=
histGetEnvNBins
();
...
...
src/process.c
View file @
83e92d36
...
...
@@ -127,6 +127,8 @@ int processSelf(void)
#if defined (HAVE_LIBPTHREAD)
int
thID
=
(
int
)
pthread_self
();
pthread_mutex_lock
(
&
processMutex
);
for
(
processID
=
0
;
processID
<
NumProcess
;
processID
++
)
if
(
Process
[
processID
].
threadID
==
thID
)
break
;
...
...
@@ -137,6 +139,9 @@ int processSelf(void)
else
processID
=
0
;
}
pthread_mutex_unlock
(
&
processMutex
);
#endif
return
(
processID
);
...
...
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