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
libcdi
Commits
bcbab308
Commit
bcbab308
authored
Nov 29, 2010
by
Uwe Schulzweida
Browse files
docu update
parent
1bb223ef
Changes
14
Hide whitespace changes
Inline
Side-by-side
doc/tex/c_grid.tex
View file @
bcbab308
...
...
@@ -38,16 +38,16 @@ Here is an example using {\tt gridCreate} to create a regular lon/lat Grid:
#include "cdi.h"
...
#define
NLON
12
#define
NLAT
6
#define
nlon
12
#define
nlat
6
...
double lons[
NLON
] =
{
0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330
}
;
double lats[
NLAT
] =
{
-75, -45, -15, 15, 45, 75
}
;
double lons[
nlon
] =
{
0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330
}
;
double lats[
nlat
] =
{
-75, -45, -15, 15, 45, 75
}
;
int gridID;
...
gridID = gridCreate(GRID
_
LONLAT,
NLON*NLAT
);
gridDefXsize(gridID,
NLON
);
gridDefYsize(gridID,
NLAT
);
gridID = gridCreate(GRID
_
LONLAT,
nlon*nlat
);
gridDefXsize(gridID,
nlon
);
gridDefYsize(gridID,
nlat
);
gridDefXvals(gridID, lons);
gridDefYvals(gridID, lats);
...
...
...
doc/tex/c_zaxis.tex
View file @
bcbab308
...
...
@@ -38,12 +38,12 @@ Here is an example using {\tt zaxisCreate} to create a pressure level Z-axis:
#include "cdi.h"
...
#define
NLEV
5
#define
nlev
5
...
double levs[
NLEV
] =
{
101300, 92500, 85000, 50000, 20000
}
;
double levs[
nlev
] =
{
101300, 92500, 85000, 50000, 20000
}
;
int zaxisID;
...
zaxisID = zaxisCreate(ZAXIS
_
PRESSURE,
NLEV
);
zaxisID = zaxisCreate(ZAXIS
_
PRESSURE,
nlev
);
zaxisDefLevels(zaxisID, levs);
...
\end{lstlisting}
...
...
doc/tex/f_grid.tex
View file @
bcbab308
...
...
@@ -38,16 +38,16 @@ Here is an example using {\tt gridCreate} to create a regular lon/lat Grid:
INCLUDE 'cdi.h'
...
#define
NLON
12
#define
NLAT
6
#define
nlon
12
#define
nlat
6
...
REAL*8 lons(
NLON
) = (/0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330/)
REAL*8 lats(
NLAT
) = (/-75, -45, -15, 15, 45, 75/)
REAL*8 lons(
nlon
) = (/0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330/)
REAL*8 lats(
nlat
) = (/-75, -45, -15, 15, 45, 75/)
INTEGER gridID
...
gridID = gridCreate(GRID
_
LONLAT,
NLON*NLAT
)
CALL gridDefXsize(gridID,
NLON
)
CALL gridDefYsize(gridID,
NLAT
)
gridID = gridCreate(GRID
_
LONLAT,
nlon*nlat
)
CALL gridDefXsize(gridID,
nlon
)
CALL gridDefYsize(gridID,
nlat
)
CALL gridDefXvals(gridID, lons)
CALL gridDefYvals(gridID, lats)
...
...
...
doc/tex/f_zaxis.tex
View file @
bcbab308
...
...
@@ -38,12 +38,12 @@ Here is an example using {\tt zaxisCreate} to create a pressure level Z-axis:
INCLUDE 'cdi.h'
...
#define
NLEV
5
#define
nlev
5
...
REAL*8 levs(
NLEV
) = (/101300, 92500, 85000, 50000, 20000/)
REAL*8 levs(
nlev
) = (/101300, 92500, 85000, 50000, 20000/)
INTEGER zaxisID
...
zaxisID = zaxisCreate(ZAXIS
_
PRESSURE,
NLEV
)
zaxisID = zaxisCreate(ZAXIS
_
PRESSURE,
nlev
)
CALL zaxisDefLevels(zaxisID, levs)
...
\end{lstlisting}
...
...
examples/cdi_copy.c
View file @
bcbab308
#include
<stdio.h>
#include
"cdi.h"
#define NLON
12
/* Number of longitudes */
#define NLAT
6
/* Number of latitudes */
#define NLEV
5
/* Number of levels */
#define NTIME
3
/* Number of time steps */
int
nlon
=
12
;
/* Number of longitudes */
int
nlat
=
6
;
/* Number of latitudes */
int
nlev
=
5
;
/* Number of levels */
int
nts
=
3
;
/* Number of time steps */
int
main
(
void
)
{
int
taxisID
,
vlistID1
,
vlistID2
,
varID1
,
varID2
,
streamID1
,
streamID2
,
tsID
;
int
nmiss
,
vdate
,
vtime
;
double
var1
[
NLON
*
NLAT
];
double
var2
[
NLON
*
NLAT
*
NLEV
];
double
var1
[
nlon
*
nlat
];
double
var2
[
nlon
*
nlat
*
nlev
];
/* Open the input dataset */
...
...
@@ -45,7 +45,7 @@ int main(void)
streamDefVlist
(
streamID2
,
vlistID2
);
/* Loop over the number of time steps */
for
(
tsID
=
0
;
tsID
<
NTIME
;
tsID
++
)
for
(
tsID
=
0
;
tsID
<
nts
;
tsID
++
)
{
/* Inquire the input time step */
streamInqTimestep
(
streamID1
,
tsID
);
...
...
examples/cdi_copy_f.f
View file @
bcbab308
...
...
@@ -4,16 +4,16 @@
INCLUDE
'cdi.inc'
INTEGER
NLON
,
NLAT
,
NLEV
,
NTIME
PARAMETER
(
NLON
=
12
)
! Number of longitudes
PARAMETER
(
NLAT
=
6
)
! Number of latitudes
PARAMETER
(
NLEV
=
5
)
! Number of levels
PARAMETER
(
NTIME
=
3
)
! Number of time steps
INTEGER
nlon
,
nlat
,
nlev
,
nts
PARAMETER
(
nlon
=
12
)
! Number of longitudes
PARAMETER
(
nlat
=
6
)
! Number of latitudes
PARAMETER
(
nlev
=
5
)
! Number of levels
PARAMETER
(
nts
=
3
)
! Number of time steps
INTEGER
gridID
,
zaxisID1
,
zaxisID2
,
taxisID
,
tsID
INTEGER
vlistID1
,
vlistID2
,
varID1
,
varID2
,
streamID1
,
streamID2
INTEGER
i
,
nmiss
,
status
,
vdate
,
vtime
REAL
*
8
var1
(
NLON
*
NLAT
),
var2
(
NLON
*
NLAT
*
NLEV
)
REAL
*
8
var1
(
nlon
*
nlat
),
var2
(
nlon
*
nlat
*
nlev
)
! Open the input dataset
streamID1
=
streamOpenRead
(
"example.nc"
)
...
...
@@ -44,7 +44,7 @@
CALL
streamDefVlist
(
streamID2
,
vlistID2
)
! Loop over the number of time steps
DO
tsID
=
0
,
NTIME
-1
DO
tsID
=
0
,
nts
-1
! Inquire the input time step */
status
=
streamInqTimestep
(
streamID1
,
tsID
)
...
...
examples/cdi_read.c
View file @
bcbab308
#include
<stdio.h>
#include
"cdi.h"
#define NLON
12
/* Number of longitudes */
#define NLAT
6
/* Number of latitudes */
#define NLEV
5
/* Number of levels */
#define NTIME
3
/* Number of time steps */
int
nlon
=
12
;
/* Number of longitudes */
int
nlat
=
6
;
/* Number of latitudes */
int
nlev
=
5
;
/* Number of levels */
int
nts
=
3
;
/* Number of time steps */
int
main
(
void
)
{
int
taxisID
,
vlistID
,
varID1
,
varID2
,
streamID
,
tsID
;
int
nmiss
,
vdate
,
vtime
;
double
var1
[
NLON
*
NLAT
];
double
var2
[
NLON
*
NLAT
*
NLEV
];
double
var1
[
nlon
*
nlat
];
double
var2
[
nlon
*
nlat
*
nlev
];
/* Open the dataset */
...
...
@@ -33,7 +33,7 @@ int main(void)
taxisID
=
vlistInqTaxis
(
vlistID
);
/* Loop over the number of time steps */
for
(
tsID
=
0
;
tsID
<
NTIME
;
tsID
++
)
for
(
tsID
=
0
;
tsID
<
nts
;
tsID
++
)
{
/* Inquire the time step */
streamInqTimestep
(
streamID
,
tsID
);
...
...
examples/cdi_read_f.f
View file @
bcbab308
...
...
@@ -4,16 +4,16 @@
INCLUDE
'cdi.inc'
INTEGER
NLON
,
NLAT
,
NLEV
,
NTIME
PARAMETER
(
NLON
=
12
)
! Number of longitudes
PARAMETER
(
NLAT
=
6
)
! Number of latitudes
PARAMETER
(
NLEV
=
5
)
! Number of levels
PARAMETER
(
NTIME
=
3
)
! Number of time steps
INTEGER
nlon
,
nlat
,
nlev
,
nts
PARAMETER
(
nlon
=
12
)
! Number of longitudes
PARAMETER
(
nlat
=
6
)
! Number of latitudes
PARAMETER
(
nlev
=
5
)
! Number of levels
PARAMETER
(
nts
=
3
)
! Number of time steps
INTEGER
gridID
,
zaxisID1
,
zaxisID2
,
taxisID
INTEGER
vlistID
,
varID1
,
varID2
,
streamID
,
tsID
INTEGER
nmiss
,
status
,
vdate
,
vtime
REAL
*
8
var1
(
NLON
*
NLAT
),
var2
(
NLON
*
NLAT
*
NLEV
)
REAL
*
8
var1
(
nlon
*
nlat
),
var2
(
nlon
*
nlat
*
nlev
)
! Open the dataset
streamID
=
streamOpenRead
(
"example.nc"
)
...
...
@@ -33,7 +33,7 @@
taxisID
=
vlistInqTaxis
(
vlistID
)
! Loop over the number of time steps
DO
tsID
=
0
,
NTIME
-1
DO
tsID
=
0
,
nts
-1
! Inquire the time step
status
=
streamInqTimestep
(
streamID
,
tsID
)
...
...
examples/cdi_write.c
View file @
bcbab308
#include
<stdio.h>
#include
"cdi.h"
#define
NLON
12
/* Number of longitudes */
#define
NLAT
6
/* Number of latitudes */
#define
NLEV
5
/* Number of levels */
#define
NTIME
3
/* Number of time steps */
#define
nlon
12
/* Number of longitudes */
#define
nlat
6
/* Number of latitudes */
#define
nlev
5
/* Number of levels */
#define
nts
3
/* Number of time steps */
int
main
(
void
)
{
int
gridID
,
zaxisID1
,
zaxisID2
,
taxisID
;
int
vlistID
,
varID1
,
varID2
,
streamID
,
tsID
;
int
i
,
nmiss
=
0
;
double
lons
[
NLON
]
=
{
0
,
30
,
60
,
90
,
120
,
150
,
180
,
210
,
240
,
270
,
300
,
330
};
double
lats
[
NLAT
]
=
{
-
75
,
-
45
,
-
15
,
15
,
45
,
75
};
double
levs
[
NLEV
]
=
{
101300
,
92500
,
85000
,
50000
,
20000
};
double
var1
[
NLON
*
NLAT
];
double
var2
[
NLON
*
NLAT
*
NLEV
];
double
lons
[
nlon
]
=
{
0
,
30
,
60
,
90
,
120
,
150
,
180
,
210
,
240
,
270
,
300
,
330
};
double
lats
[
nlat
]
=
{
-
75
,
-
45
,
-
15
,
15
,
45
,
75
};
double
levs
[
nlev
]
=
{
101300
,
92500
,
85000
,
50000
,
20000
};
double
var1
[
nlon
*
nlat
];
double
var2
[
nlon
*
nlat
*
nlev
];
/* Create a regular lon/lat grid */
gridID
=
gridCreate
(
GRID_LONLAT
,
NLON
*
NLAT
);
gridDefXsize
(
gridID
,
NLON
);
gridDefYsize
(
gridID
,
NLAT
);
gridID
=
gridCreate
(
GRID_LONLAT
,
nlon
*
nlat
);
gridDefXsize
(
gridID
,
nlon
);
gridDefYsize
(
gridID
,
nlat
);
gridDefXvals
(
gridID
,
lons
);
gridDefYvals
(
gridID
,
lats
);
...
...
@@ -29,7 +29,7 @@ int main(void)
zaxisID1
=
zaxisCreate
(
ZAXIS_SURFACE
,
1
);
/* Create a pressure level Z-axis */
zaxisID2
=
zaxisCreate
(
ZAXIS_PRESSURE
,
NLEV
);
zaxisID2
=
zaxisCreate
(
ZAXIS_PRESSURE
,
nlev
);
zaxisDefLevels
(
zaxisID2
,
levs
);
/* Create a variable list */
...
...
@@ -61,7 +61,7 @@ int main(void)
streamDefVlist
(
streamID
,
vlistID
);
/* Loop over the number of time steps */
for
(
tsID
=
0
;
tsID
<
NTIME
;
tsID
++
)
for
(
tsID
=
0
;
tsID
<
nts
;
tsID
++
)
{
/* Set the verification date to 1985-01-01 + tsID */
taxisDefVdate
(
taxisID
,
19850101
+
tsID
);
...
...
@@ -71,8 +71,8 @@ int main(void)
streamDefTimestep
(
streamID
,
tsID
);
/* Init var1 and var2 */
for
(
i
=
0
;
i
<
NLON
*
NLAT
;
i
++
)
var1
[
i
]
=
1
.
1
;
for
(
i
=
0
;
i
<
NLON
*
NLAT
*
NLEV
;
i
++
)
var2
[
i
]
=
2
.
2
;
for
(
i
=
0
;
i
<
nlon
*
nlat
;
i
++
)
var1
[
i
]
=
1
.
1
;
for
(
i
=
0
;
i
<
nlon
*
nlat
*
nlev
;
i
++
)
var2
[
i
]
=
2
.
2
;
/* Write var1 and var2 */
streamWriteVar
(
streamID
,
varID1
,
var1
,
nmiss
);
...
...
examples/cdi_write_f.f
View file @
bcbab308
...
...
@@ -4,17 +4,17 @@
INCLUDE
'cdi.inc'
INTEGER
NLON
,
NLAT
,
NLEV
,
NTIME
PARAMETER
(
NLON
=
12
)
! Number of longitudes
PARAMETER
(
NLAT
=
6
)
! Number of latitudes
PARAMETER
(
NLEV
=
5
)
! Number of levels
PARAMETER
(
NTIME
=
3
)
! Number of time steps
INTEGER
nlon
,
nlat
,
nlev
,
nts
PARAMETER
(
nlon
=
12
)
! Number of longitudes
PARAMETER
(
nlat
=
6
)
! Number of latitudes
PARAMETER
(
nlev
=
5
)
! Number of levels
PARAMETER
(
nts
=
3
)
! Number of time steps
INTEGER
gridID
,
zaxisID1
,
zaxisID2
,
taxisID
INTEGER
vlistID
,
varID1
,
varID2
,
streamID
,
tsID
INTEGER
i
,
nmiss
,
status
REAL
*
8
lons
(
NLON
),
lats
(
NLAT
),
levs
(
NLEV
)
REAL
*
8
var1
(
NLON
*
NLAT
),
var2
(
NLON
*
NLAT
*
NLEV
)
REAL
*
8
lons
(
nlon
),
lats
(
nlat
),
levs
(
nlev
)
REAL
*
8
var1
(
nlon
*
nlat
),
var2
(
nlon
*
nlat
*
nlev
)
DATA
lons
/
0
,
30
,
60
,
90
,
120
,
150
,
180
,
210
,
240
,
270
,
300
,
330
/
DATA
lats
/
-75
,
-45
,
-15
,
15
,
45
,
75
/
...
...
@@ -23,9 +23,9 @@
nmiss
=
0
! Create a regular lon/lat grid
gridID
=
gridCreate
(
GRID_LONLAT
,
NLON
*
NLAT
)
CALL
gridDefXsize
(
gridID
,
NLON
)
CALL
gridDefYsize
(
gridID
,
NLAT
)
gridID
=
gridCreate
(
GRID_LONLAT
,
nlon
*
nlat
)
CALL
gridDefXsize
(
gridID
,
nlon
)
CALL
gridDefYsize
(
gridID
,
nlat
)
CALL
gridDefXvals
(
gridID
,
lons
)
CALL
gridDefYvals
(
gridID
,
lats
)
...
...
@@ -33,7 +33,7 @@
zaxisID1
=
zaxisCreate
(
ZAXIS_SURFACE
,
1
)
! Create a pressure level Z-axis
zaxisID2
=
zaxisCreate
(
ZAXIS_PRESSURE
,
NLEV
)
zaxisID2
=
zaxisCreate
(
ZAXIS_PRESSURE
,
nlev
)
CALL
zaxisDefLevels
(
zaxisID2
,
levs
)
! Create a variable list
...
...
@@ -64,7 +64,7 @@
CALL
streamDefVlist
(
streamID
,
vlistID
)
! Loop over the number of time steps
DO
tsID
=
0
,
NTIME
-1
DO
tsID
=
0
,
nts
-1
! Set the verification date to 1985-01-01 + tsID
CALL
taxisDefVdate
(
taxisID
,
19850101
+
tsID
)
! Set the verification time to 12:00:00
...
...
@@ -73,10 +73,10 @@
status
=
streamDefTimestep
(
streamID
,
tsID
)
! Init var1 and var2
DO
i
=
1
,
NLON
*
NLAT
DO
i
=
1
,
nlon
*
nlat
var1
(
i
)
=
1.1
END
DO
DO
i
=
1
,
NLON
*
NLAT
*
NLEV
DO
i
=
1
,
nlon
*
nlat
*
nlev
var2
(
i
)
=
2.2
END
DO
...
...
examples/cdi_write_f2003.f90
View file @
bcbab308
...
...
@@ -5,17 +5,17 @@
IMPLICIT
NONE
INTEGER
NLON
,
NLAT
,
NLEV
,
NTIME
PARAMETER
(
NLON
=
12
)
! Number of longitudes
PARAMETER
(
NLAT
=
6
)
! Number of latitudes
PARAMETER
(
NLEV
=
5
)
! Number of levels
PARAMETER
(
NTIME
=
3
)
! Number of time steps
INTEGER
nlon
,
nlat
,
nlev
,
nts
PARAMETER
(
nlon
=
12
)
! Number of longitudes
PARAMETER
(
nlat
=
6
)
! Number of latitudes
PARAMETER
(
nlev
=
5
)
! Number of levels
PARAMETER
(
nts
=
3
)
! Number of time steps
INTEGER
gridID
,
zaxisID1
,
zaxisID2
,
taxisID
INTEGER
vlistID
,
varID1
,
varID2
,
streamID
,
tsID
INTEGER
i
,
nmiss
,
status
DOUBLE PRECISION
lons
(
NLON
),
lats
(
NLAT
),
levs
(
NLEV
)
DOUBLE PRECISION
var1
(
NLON
*
NLAT
),
var2
(
NLON
*
NLAT
*
NLEV
)
DOUBLE PRECISION
lons
(
nlon
),
lats
(
nlat
),
levs
(
nlev
)
DOUBLE PRECISION
var1
(
nlon
*
nlat
),
var2
(
nlon
*
nlat
*
nlev
)
CHARACTER
(
len
=
256
)
::
varname
DATA
lons
/
0
,
30
,
60
,
90
,
120
,
150
,
180
,
210
,
240
,
270
,
300
,
330
/
...
...
@@ -25,9 +25,9 @@
nmiss
=
0
! Create a regular lon/lat grid
gridID
=
gridCreate
(
GRID_LO
NLAT
,
NLON
*
NLAT
)
CALL
gridDefXsize
(
gridID
,
NLON
)
CALL
gridDefYsize
(
gridID
,
NLAT
)
gridID
=
gridCreate
(
GRID_LO
nlat
,
nlon
*
nlat
)
CALL
gridDefXsize
(
gridID
,
nlon
)
CALL
gridDefYsize
(
gridID
,
nlat
)
CALL
gridDefXvals
(
gridID
,
lons
)
CALL
gridDefYvals
(
gridID
,
lats
)
...
...
@@ -35,7 +35,7 @@
zaxisID1
=
zaxisCreate
(
ZAXIS_SURFACE
,
1
)
! Create a pressure level Z-axis
zaxisID2
=
zaxisCreate
(
ZAXIS_PRESSURE
,
NLEV
)
zaxisID2
=
zaxisCreate
(
ZAXIS_PRESSURE
,
nlev
)
CALL
zaxisDefLevels
(
zaxisID2
,
levs
)
! Create a variable list
...
...
@@ -67,7 +67,7 @@
CALL
streamDefVlist
(
streamID
,
vlistID
)
! Loop over the number of time steps
DO
tsID
=
0
,
NTIME
-1
DO
tsID
=
0
,
nts
-1
! Set the verification date to 1985-01-01 + tsID
CALL
taxisDefVdate
(
taxisID
,
19850101
+
tsID
)
! Set the verification time to 12:00
...
...
@@ -76,10 +76,10 @@
status
=
streamDefTimestep
(
streamID
,
tsID
)
! Init var1 and var2
DO
i
=
1
,
NLON
*
NLAT
DO
i
=
1
,
nlon
*
nlat
var1
(
i
)
=
1.1
END
DO
DO
i
=
1
,
NLON
*
NLAT
*
NLEV
DO
i
=
1
,
nlon
*
nlat
*
nlev
var2
(
i
)
=
2.2
END
DO
...
...
src/cdi.inc
View file @
bcbab308
!
This
file
was
automatically
created
,
don
'
t
edit
!
!
!
Fortran
interface
for
CDI
library
version
1.4.
6
!
Fortran
interface
for
CDI
library
version
1.4.
7
!
!
Author
:
!
-------
!
Uwe
Schulzweida
,
MPI
-
MET
,
Hamburg
,
Sept
ember
2010
!
Uwe
Schulzweida
,
MPI
-
MET
,
Hamburg
,
Nov
ember
2010
!
INTEGER
CDI_UNDEFID
...
...
src/grid.c
View file @
bcbab308
...
...
@@ -487,16 +487,16 @@ Here is an example using @func{gridCreate} to create a regular lon/lat Grid:
@Source
#include "cdi.h"
...
#define
NLON
12
#define
NLAT
6
#define
nlon
12
#define
nlat
6
...
double lons[
NLON
] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330};
double lats[
NLAT
] = {-75, -45, -15, 15, 45, 75};
double lons[
nlon
] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330};
double lats[
nlat
] = {-75, -45, -15, 15, 45, 75};
int gridID;
...
gridID = gridCreate(GRID_LONLAT,
NLON*NLAT
);
gridDefXsize(gridID,
NLON
);
gridDefYsize(gridID,
NLAT
);
gridID = gridCreate(GRID_LONLAT,
nlon*nlat
);
gridDefXsize(gridID,
nlon
);
gridDefYsize(gridID,
nlat
);
gridDefXvals(gridID, lons);
gridDefYvals(gridID, lats);
...
...
...
src/zaxis.c
View file @
bcbab308
...
...
@@ -323,12 +323,12 @@ Here is an example using @func{zaxisCreate} to create a pressure level Z-axis:
@Source
#include "cdi.h"
...
#define
NLEV
5
#define
nlev
5
...
double levs[
NLEV
] = {101300, 92500, 85000, 50000, 20000};
double levs[
nlev
] = {101300, 92500, 85000, 50000, 20000};
int zaxisID;
...
zaxisID = zaxisCreate(ZAXIS_PRESSURE,
NLEV
);
zaxisID = zaxisCreate(ZAXIS_PRESSURE,
nlev
);
zaxisDefLevels(zaxisID, levs);
...
@EndSource
...
...
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