Skip to content
Snippets Groups Projects
Commit 6fd4eada authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

No commit message

No commit message
parent 3832330c
No related merge requests found
......@@ -73,7 +73,7 @@ examples/Makefile.in -text
examples/cdi_copy.c -text
examples/cdi_copy_f.f -text
examples/cdi_read.c -text
examples/cdi_read_example.f -text
examples/cdi_read_example.f90 -text
examples/cdi_read_f.f -text
examples/cdi_write.c -text
examples/cdi_write_f.f -text
......
......@@ -29,10 +29,10 @@ int main(void)
varID1 = 0;
varID2 = 1;
/* Get the Time axis form the variable list */
/* Get the Time axis from the variable list */
taxisID = vlistInqTaxis(vlistID1);
/* Open the output dataset (GRIB format) */
/* Open the output dataset (GRIB fromat) */
streamID2 = streamOpenWrite("example.grb", FILETYPE_GRB);
if ( streamID2 < 0 )
{
......
......@@ -29,10 +29,10 @@
varID1 = 0
varID2 = 1
! Get the Time axis form the variable list
! Get the Time axis from the variable list
taxisID = vlistInqTaxis(vlistID1)
! Open the output dataset (GRIB format)
! Open the output dataset (GRIB fromat)
streamID2 = streamOpenWrite("example.grb", FILETYPE_GRB)
IF ( streamID2 < 0 ) THEN
WRITE(0,*) cdiStringError(streamID2)
......
......@@ -29,7 +29,7 @@ int main(void)
varID1 = 0;
varID2 = 1;
/* Get the Time axis form the variable list */
/* Get the Time axis from the variable list */
taxisID = vlistInqTaxis(vlistID);
/* Loop over the number of time steps */
......
PROGRAM CDIREAD
PROGRAM CDIREAD
IMPLICIT NONE
IMPLICIT NONE
INCLUDE 'cdi.inc'
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 :: gridsize, nlevel, nvars, code
INTEGER :: i, varID, levelID
REAL*8, ALLOCATABLE :: field(:,:)
CHARACTER(len=256) :: name, longname, units
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)
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
! Open the dataset
streamID = streamOpenRead("example.nc")
IF ( streamID < 0 ) THEN
WRITE(0,*) cdiStringError(streamID)
STOP
END IF
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)
! Get the variable list of the dataset
vlistID = streamInqVlist(streamID)
! Open the dataset
streamID = streamOpenRead("example.nc")
IF ( streamID < 0 ) THEN
WRITE(0,*) cdiStringError(streamID)
STOP
END IF
! Get the variable list of the dataset
vlistID = streamInqVlist(streamID)
nvars = vlistNvars(vlistID)
WRITE(*,*) 'nvars: ', nvars
DO varID = 0, nvars-1
code = vlistInqVarCode(vlistID, varID)
CALL vlistInqVarName(vlistID, varID, name)
CALL vlistInqVarLongname(vlistID, varID, longname)
CALL vlistInqVarUnits(vlistID, varID, units)
WRITE(*,*) varID, code, TRIM(name), TRIM(longname), TRIM(units)
END DO
! Set the variable IDs
varID1 = 0
varID2 = 1
! Get the Time axis form the variable list
taxisID = vlistInqTaxis(vlistID)
......@@ -49,4 +63,5 @@
! Close the input stream
CALL streamClose(streamID)
END
END PROGRAM CDIREAD
......@@ -29,7 +29,7 @@
varID1 = 0
varID2 = 1
! Get the Time axis form the variable list
! Get the Time axis from the variable list
taxisID = vlistInqTaxis(vlistID)
! Loop over the number of time steps
......
......@@ -49,7 +49,7 @@ int main(void)
/* Assign the Time axis to the variable list */
vlistDefTaxis(vlistID, taxisID);
/* Create a dataset in netCDF format */
/* Create a dataset in netCDF fromat */
streamID = streamOpenWrite("example.nc", FILETYPE_NC);
if ( streamID < 0 )
{
......
......@@ -53,7 +53,7 @@
! Assign the Time axis to the variable list
CALL vlistDefTaxis(vlistID, taxisID)
! Create a dataset in netCDF format
! Create a dataset in netCDF fromat
streamID = streamOpenWrite("example.nc", FILETYPE_NC)
IF ( streamID < 0 ) THEN
WRITE(0,*) cdiStringError(streamID)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment