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
6ff70e26
Commit
6ff70e26
authored
Oct 14, 2006
by
Uwe Schulzweida
Browse files
new operator topo
parent
2db096e2
Changes
6
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
6ff70e26
...
...
@@ -5,6 +5,7 @@
* remaplib.sort_add: don't sort if num_links <= 1
* remaplib.remap_bi?: check that src_add is valid
* Remap: use REMAP_NON_GLOBAL only for gridsize > 1
* pstreamDefVlist: remove Read -> Write data-race on pstreamptr->vlistID
* Version 1.0.3 released
2006-09-18 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
...
...
src/Intgrid.c
View file @
6ff70e26
...
...
@@ -18,7 +18,8 @@
/*
This module contains the following operators:
Intgrid interpolate Interpolate
Intgrid interpolate PINGO grid interpolation
Intgrid intgridbil Bilinear grid interpolation
*/
...
...
src/Vargen.c
View file @
6ff70e26
...
...
@@ -35,14 +35,18 @@
void
*
Vargen
(
void
*
argument
)
{
static
char
func
[]
=
"Vargen"
;
int
RANDOM
,
CONST
;
int
RANDOM
,
CONST
,
TOPO
;
int
operatorID
;
int
streamID
;
int
nrecs
;
int
tsID
,
recID
,
varID
,
levelID
;
int
gridsize
,
i
;
int
vlistID
;
int
gridID
,
zaxisID
,
taxisID
;
int
gridID
=
-
1
,
zaxisID
,
taxisID
;
double
etopo_scale
=
3
;
short
etopo
[]
=
{
#include
"etopo.h"
};
const
char
*
gridfile
;
double
rconst
=
0
.
0
;
double
*
array
;
...
...
@@ -51,24 +55,42 @@ void *Vargen(void *argument)
RANDOM
=
cdoOperatorAdd
(
"random"
,
0
,
0
,
"grid description file or name"
);
CONST
=
cdoOperatorAdd
(
"const"
,
0
,
0
,
"constant value, grid description file or name"
);
TOPO
=
cdoOperatorAdd
(
"topo"
,
0
,
0
,
""
);
operatorID
=
cdoOperatorID
();
operatorInputArg
(
cdoOperatorEnter
(
operatorID
));
if
(
operatorID
==
RANDOM
)
{
operatorInputArg
(
cdoOperatorEnter
(
operatorID
));
operatorCheckArgc
(
1
);
gridfile
=
operatorArgv
()[
0
];
gridID
=
cdoDefineGrid
(
gridfile
);
}
else
else
if
(
operatorID
==
CONST
)
{
operatorInputArg
(
cdoOperatorEnter
(
operatorID
));
operatorCheckArgc
(
2
);
rconst
=
atof
(
operatorArgv
()[
0
]);
gridfile
=
operatorArgv
()[
1
];
gridID
=
cdoDefineGrid
(
gridfile
);
}
else
if
(
operatorID
==
TOPO
)
{
int
nlon
,
nlat
,
i
;
double
lon
[
720
],
lat
[
360
];
nlon
=
720
;
nlat
=
360
;
gridID
=
gridCreate
(
GRID_LONLAT
,
nlon
*
nlat
);
gridDefXsize
(
gridID
,
nlon
);
gridDefYsize
(
gridID
,
nlat
);
for
(
i
=
0
;
i
<
nlon
;
i
++
)
lon
[
i
]
=
-
179
.
75
+
i
*
0
.
5
;
for
(
i
=
0
;
i
<
nlat
;
i
++
)
lat
[
i
]
=
-
89
.
75
+
i
*
0
.
5
;
gridDefXvals
(
gridID
,
lon
);
gridDefYvals
(
gridID
,
lat
);
}
gridID
=
cdoDefineGrid
(
gridfile
);
zaxisID
=
zaxisCreate
(
ZAXIS_SURFACE
,
1
);
...
...
@@ -100,11 +122,16 @@ void *Vargen(void *argument)
for
(
i
=
0
;
i
<
gridsize
;
i
++
)
array
[
i
]
=
rand
()
/
(
RAND_MAX
+
1
.
0
);
}
else
else
if
(
operatorID
==
CONST
)
{
for
(
i
=
0
;
i
<
gridsize
;
i
++
)
array
[
i
]
=
rconst
;
}
else
if
(
operatorID
==
TOPO
)
{
for
(
i
=
0
;
i
<
gridsize
;
i
++
)
array
[
i
]
=
etopo
[
i
]
/
etopo_scale
;
}
streamWriteRecord
(
streamID
,
array
,
0
);
}
...
...
src/interpol.c
View file @
6ff70e26
...
...
@@ -129,6 +129,9 @@ void intgrid(FIELD *field1, FIELD *field2)
arrayOut
=
field2
->
ptr
;
missval
=
field1
->
missval
;
if
(
!
(
gridInqXvals
(
gridIDin
,
NULL
)
&&
gridInqYvals
(
gridIDin
,
NULL
))
)
cdoAbort
(
"Source grid has no values"
);
nlonIn
=
gridInqXsize
(
gridIDin
);
nlatIn
=
gridInqYsize
(
gridIDin
);
lonIn
=
(
double
*
)
malloc
(
nlonIn
*
sizeof
(
double
));
...
...
@@ -136,6 +139,9 @@ void intgrid(FIELD *field1, FIELD *field2)
gridInqXvals
(
gridIDin
,
lonIn
);
gridInqYvals
(
gridIDin
,
latIn
);
if
(
!
(
gridInqXvals
(
gridIDout
,
NULL
)
&&
gridInqYvals
(
gridIDout
,
NULL
))
)
cdoAbort
(
"Target grid has no values"
);
nlonOut
=
gridInqXsize
(
gridIDout
);
nlatOut
=
gridInqYsize
(
gridIDout
);
lonOut
=
(
double
*
)
malloc
(
nlonOut
*
sizeof
(
double
));
...
...
@@ -512,6 +518,12 @@ void interpolate(FIELD *field1, FIELD *field2)
lon
=
lon_array
+
1
;
lat
=
lat_array
+
1
;
if
(
!
(
gridInqXvals
(
gridIDi
,
NULL
)
&&
gridInqYvals
(
gridIDi
,
NULL
))
)
cdoAbort
(
"Source grid has no values"
);
if
(
!
(
gridInqXvals
(
gridIDo
,
NULL
)
&&
gridInqYvals
(
gridIDo
,
NULL
))
)
cdoAbort
(
"Target grid has no values"
);
gridInqXvals
(
gridIDi
,
lon
);
gridInqYvals
(
gridIDi
,
lat
);
...
...
src/modules.c
View file @
6ff70e26
...
...
@@ -224,7 +224,7 @@ void *Zonstat(void *argument);
#define TrendOperators {"trend"}
#define TrmsOperators {"trms"}
#define VardupOperators {"vardup", "varmul"}
#define VargenOperators {"random", "const"}
#define VargenOperators {"random", "const"
, "topo"
}
#define VarrmsOperators {"varrms"}
#define VertintOperators {"ml2pl", "ml2hl"}
#define VertstatOperators {"vertmin", "vertmax", "vertsum", "vertmean", "vertavg", "vertstd"}
...
...
src/pstream.c
View file @
6ff70e26
...
...
@@ -787,8 +787,6 @@ void pstreamDefVlist(int pstreamID, int vlistID)
pstreamptr
=
pstream_to_pointer
(
pstreamID
);
pstreamptr
->
vlistID
=
vlistID
;
#if defined (HAVE_LIBPTHREAD)
if
(
pstreamptr
->
ispipe
)
{
...
...
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