Commit 4b8cc0ae authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Change data type of nmiss in examples.

parent eec19359
......@@ -7,7 +7,7 @@ int main(void)
const int nlat = 6; // Number of latitudes
const int nlev = 5; // Number of levels
const int nts = 3; // Number of time steps
int nmiss;
size_t nmiss;
double var1[nlon*nlat];
double var2[nlon*nlat*nlev];
......
......@@ -12,7 +12,8 @@
INTEGER gridID, zaxisID1, zaxisID2, tsID
INTEGER vlistID1, vlistID2, varID1, varID2, streamID1, streamID2
INTEGER i, nmiss, status
INTEGER i, status
INTEGER*8 nmiss
REAL*8 var1(nlon*nlat), var2(nlon*nlat*nlev)
! Open the input dataset
......
......@@ -10,8 +10,9 @@
int main(int argc, char *argv[])
{
int linfo = 0;
int vlistID1, vlistID2, varID, streamID1, streamID2, tsID;
int nmiss, nvars, status, gridsize;
int vlistID1, vlistID2, varID, streamID1, streamID2;
size_t nmiss;
int nvars, status;
double *vardata = NULL;
const char *ifile, *ofile;
......@@ -35,7 +36,7 @@ int main(int argc, char *argv[])
/* Get the variable list of the dataset */
vlistID1 = streamInqVlist(streamID1);
nvars = vlistNvars(vlistID1);
gridsize = vlistGridsizeMax(vlistID1);
size_t gridsize = vlistGridsizeMax(vlistID1);
vardata = (double *) malloc(gridsize*MAX_LEVEL*sizeof(double));
......@@ -52,7 +53,7 @@ int main(int argc, char *argv[])
streamDefVlist(streamID2, vlistID2);
/* Loop over all time steps */
tsID = 0;
int tsID = 0;
while ( (status = streamInqTimestep(streamID1, tsID)) )
{
/* Define the output time step */
......
......@@ -7,7 +7,7 @@ int main(void)
const int nlat = 6; // Number of latitudes
const int nlev = 5; // Number of levels
const int nts = 3; // Number of time steps
int nmiss, vdate, vtime;
size_t nmiss;
double var1[nlon*nlat];
double var2[nlon*nlat*nlev];
......@@ -37,8 +37,8 @@ int main(void)
streamInqTimestep(streamID, tsID);
// Get the verification date and time
vdate = taxisInqVdate(taxisID);
vtime = taxisInqVtime(taxisID);
int vdate = taxisInqVdate(taxisID);
int vtime = taxisInqVtime(taxisID);
printf("read timestep %d: date=%d time=%d\n", tsID+1, vdate, vtime);
// Read var1 and var2
......
......@@ -8,8 +8,8 @@ int nts = 3; // Number of time steps
int main(void)
{
int taxisID, vlistID, varID1, varID2, streamID, tsID;
int nmiss, vdate, vtime;
int taxisID, vlistID, varID1, varID2, streamID;
size_t nmiss;
double var1[nlon*nlat];
double var2[nlon*nlat*nlev];
......@@ -53,14 +53,14 @@ int main(void)
taxisID = vlistInqTaxis(vlistID);
// Loop over the number of time steps
for ( tsID = 0; tsID < nts; tsID++ )
for ( int tsID = 0; tsID < nts; tsID++ )
{
// Inquire the time step
streamInqTimestep(streamID, tsID);
// Get the verification date and time
vdate = taxisInqVdate(taxisID);
vtime = taxisInqVtime(taxisID);
int vdate = taxisInqVdate(taxisID);
int vtime = taxisInqVtime(taxisID);
// Read var1 and var2
streamReadVar(streamID, varID1, var1, &nmiss);
......
......@@ -17,7 +17,8 @@
INTEGER inst
INTEGER gridID, zaxisID1, zaxisID2, taxisID
INTEGER vlistID, varID1, varID2, streamID, tsID
INTEGER nmiss, status, vdate, vtime
INTEGER status, vdate, vtime
INTEGER*8 nmiss
REAL*8 var1(nlon*nlat), var2(nlon*nlat*nlev)
! Open the dataset
......
......@@ -5,9 +5,10 @@ PROGRAM CDIREAD
INCLUDE 'cdi.inc'
INTEGER :: gsize, nlevel, nvars, code
INTEGER :: vdate, vtime, nmiss, status, ilev
INTEGER :: vdate, vtime, status, ilev
INTEGER :: streamID, varID, levelID, gridID, zaxisID
INTEGER :: tsID, vlistID, taxisID
INTEGER*8 :: nmiss
REAL*8, ALLOCATABLE :: field(:,:)
CHARACTER(len=256) :: name, longname, units
......
......@@ -13,7 +13,8 @@
INTEGER gridID, zaxisID1, zaxisID2, taxisID
INTEGER vlistID, varID1, varID2, streamID, tsID
INTEGER nmiss, status, vdate, vtime
INTEGER status, vdate, vtime
INTEGER*8 nmiss
REAL*8 var1(nlon*nlat), var2(nlon*nlat*nlev)
! Open the dataset
......
......@@ -4,9 +4,9 @@ PROGRAM CDIREADF2003
IMPLICIT NONE
INTEGER*8 :: gsize
INTEGER*8 :: gsize, nmiss
INTEGER :: nlevel, nvars, code
INTEGER :: vdate, vtime, nmiss, status, ilev
INTEGER :: vdate, vtime, status, ilev
INTEGER :: streamID, varID, gridID, zaxisID
INTEGER :: tsID, vlistID, taxisID
DOUBLE PRECISION, ALLOCATABLE :: field(:,:)
......
......@@ -8,8 +8,8 @@ int nts = 3; // Number of time steps
int main(void)
{
int taxisID, vlistID, varID1, varID2, streamID, tsID;
int nmiss, vdate, vtime;
int taxisID, vlistID, varID1, varID2, streamID;
size_t nmiss;
float var1[nlon*nlat];
float var2[nlon*nlat*nlev];
......@@ -33,14 +33,14 @@ int main(void)
taxisID = vlistInqTaxis(vlistID);
// Loop over the number of time steps
for ( tsID = 0; tsID < nts; tsID++ )
for ( int tsID = 0; tsID < nts; tsID++ )
{
// Inquire the time step
streamInqTimestep(streamID, tsID);
// Get the verification date and time
vdate = taxisInqVdate(taxisID);
vtime = taxisInqVtime(taxisID);
int vdate = taxisInqVdate(taxisID);
int vtime = taxisInqVtime(taxisID);
// Read var1 and var2
streamReadVarF(streamID, varID1, var1, &nmiss);
......
......@@ -15,14 +15,16 @@
typedef struct {
int streamID;
int *varID, *levelID, *nmiss;
int *varID, *levelID;
size_t *nmiss;
double *array;
}
read_arg_t;
typedef struct {
int varID, levelID, nmiss;
int varID, levelID;
size_t nmiss;
double *array;
int array_size;
int recID, nrecs;
......@@ -39,7 +41,8 @@ typedef struct work_st{
typedef struct {
int varID, levelID, nmiss;
int varID, levelID;
size_t nmiss;
double *array;
int array_size;
int recID, nrecs;
......@@ -60,7 +63,8 @@ void readRecord(void *arg)
{
read_arg_t *read_arg = (read_arg_t *) arg;
int streamID;
int *varID, *levelID, *nmiss;
int *varID, *levelID;
size_t *nmiss;
double *array;
streamID = read_arg->streamID;
......@@ -249,7 +253,7 @@ void destroy_iothread(void *p)
#endif
void stream_read_record_par(int streamID, int *varID, int *levelID, double *array, int *nmiss, par_io_t *parIO)
void stream_read_record_par(int streamID, int *varID, int *levelID, double *array, size_t *nmiss, par_io_t *parIO)
{
int lpario = 0;
int recID = 0, nrecs = 0;
......@@ -311,7 +315,7 @@ void stream_read_record_par(int streamID, int *varID, int *levelID, double *arra
}
void stream_read_record(int streamID, int *varID, int *levelID, double *data, int *nmiss)
void stream_read_record(int streamID, int *varID, int *levelID, double *data, size_t *nmiss)
{
streamInqRecord(streamID, varID, levelID);
streamReadRecord(streamID, data, nmiss);
......@@ -321,7 +325,8 @@ void stream_read_record(int streamID, int *varID, int *levelID, double *data, in
int main(int argc, char *argv[])
{
int taxisID, vlistID, varID, levelID, streamID, tsID;
int nmiss, vdate, vtime;
size_t nmiss;
int vdate, vtime;
int nrecs, recID, code;
int gridsize, i;
double *data;
......
......@@ -13,7 +13,8 @@
INTEGER inst
INTEGER gridID, zaxisID1, zaxisID2, taxisID
INTEGER vlistID, varID1, varID2, streamID, tsID
INTEGER nmiss, status, vdate, vtime
INTEGER status, vdate, vtime
INTEGER*8 nmiss
REAL*8 var1(nlon*nlat), var2(nlon*nlat*nlev)
! Open the dataset
......
......@@ -9,7 +9,8 @@
INTEGER gridID, taxisID
INTEGER vlistID, varID1, streamID, tsID
INTEGER nmiss, status, vdate, vtime
INTEGER status, vdate, vtime
INTEGER*8 nmiss
REAL*8 sst(nvals)
! CALL cdiDebug(1)
......
......@@ -7,7 +7,7 @@ int main(void)
const int nlat = 6; // Number of latitudes
const int nlev = 5; // Number of levels
const int nts = 20; // Number of time steps
int nmiss, vdate, vtime;
size_t nmiss;
double var1[nlon*nlat];
double var2[nlon*nlat*nlev];
......@@ -37,8 +37,8 @@ int main(void)
streamInqTimestep(streamID, tsID);
// Get the verification date and time
vdate = taxisInqVdate(taxisID);
vtime = taxisInqVtime(taxisID);
int vdate = taxisInqVdate(taxisID);
int vtime = taxisInqVtime(taxisID);
printf("read timestep %d: date=%d time=%d\n", tsID+1, vdate, vtime);
// Read var1 and var2
......
......@@ -7,7 +7,7 @@ int main(void)
const int nlat = 6; // Number of latitudes
const int nlev = 5; // Number of levels
const int nts = 3; // Number of time steps
int nmiss = 0;
size_t nmiss = 0;
double lons[] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330};
double lats[] = {-75, -45, -15, 15, 45, 75};
double levs[] = {101300, 92500, 85000, 50000, 20000};
......@@ -68,8 +68,8 @@ int main(void)
streamDefTimestep(streamID, tsID);
// Init var1 and var2
for ( int i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1;
for ( int i = 0; i < nlon*nlat*nlev; i++ ) var2[i] = 2.2;
for ( size_t i = 0; i < nlon*nlat; i++ ) var1[i] = 1.1;
for ( size_t i = 0; i < nlon*nlat*nlev; i++ ) var2[i] = 2.2;
// Write var1 and var2
streamWriteVar(streamID, varID1, var1, nmiss);
......
......@@ -9,7 +9,7 @@ int main(void)
{
int gridID, zaxisID1, zaxisID2;
int vlistID, varID1, varID2, streamID;
int i, nmiss = 0;
size_t 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};
......
......@@ -10,7 +10,7 @@ int main(void)
{
int gridID, zaxisID1, zaxisID2, taxisID;
int vlistID, varID1, varID2, streamID, tsID;
int i, nmiss = 0;
size_t 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] = {5, 10, 50, 100, 500};
......
......@@ -18,7 +18,7 @@ int main(void)
int tsID;
int levelID;
int vlistID, taxisID;
int nmiss;
size_t nmiss;
int instID;
int i1,i2,i3;
......
......@@ -12,8 +12,8 @@
PARAMETER (nts = 3) ! Number of time steps
INTEGER gridID, zaxisID1, zaxisID2, taxisID
INTEGER vlistID, varID1, varID2, streamID, tsID
INTEGER i, nmiss, status
INTEGER vlistID, varID1, varID2, streamID, tsID, i, status
INTEGER*8 nmiss
REAL*8 lons(nlon), lats(nlat), levs(nlev)
REAL*8 var1(nlon*nlat), var2(nlon*nlat*nlev)
......
......@@ -6,7 +6,7 @@
IMPLICIT NONE
INTEGER nlev, nts
INTEGER*8 nlon, nlat
INTEGER*8 nlon, nlat, nmiss
PARAMETER (nlon = 12) ! Number of longitudes
PARAMETER (nlat = 6) ! Number of latitudes
PARAMETER (nlev = 5) ! Number of levels
......@@ -14,7 +14,7 @@
INTEGER gridID, zaxisID1, zaxisID2, taxisID
INTEGER vlistID, varID1, varID2, streamID, tsID
INTEGER i, nmiss, status
INTEGER i, status
DOUBLE PRECISION lons(nlon), lats(nlat), levs(nlev)
DOUBLE PRECISION var1(nlon*nlat), var2(nlon*nlat*nlev)
CHARACTER(len=256, kind=c_char) :: varname
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment