Commit e54c999f authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

added example/cdi_read_sst.f

parent f9b6c433
...@@ -112,6 +112,7 @@ examples/cdi_read_f.f -text ...@@ -112,6 +112,7 @@ examples/cdi_read_f.f -text
examples/cdi_read_f2003.f90 -text examples/cdi_read_f2003.f90 -text
examples/cdi_read_records.c -text examples/cdi_read_records.c -text
examples/cdi_read_simple.f -text examples/cdi_read_simple.f -text
examples/cdi_read_sst.f -text
examples/cdi_write.c -text examples/cdi_write.c -text
examples/cdi_write_ens.c -text examples/cdi_write_ens.c -text
examples/cdi_write_f.f -text examples/cdi_write_f.f -text
......
PROGRAM CDIREADSST
IMPLICIT NONE
INCLUDE 'cdi.inc'
INTEGER nvals
PARAMETER (nvals = 20480)
INTEGER gridID, taxisID
INTEGER vlistID, varID1, streamID, tsID
INTEGER nmiss, status, vdate, vtime
REAL*8 sst(nvals)
! CALL cdiDebug(1)
! Open the dataset
streamID = streamOpenRead
& ("/Users/m214003/data/icon_amip2sst_1870-2010.nc")
IF ( streamID < 0 ) THEN
WRITE(0,*) cdiStringError(streamID)
STOP
END IF
! Get the variable list of the dataset
vlistID = streamInqVlist(streamID)
! Set the variable IDs
varID1 = 0
! Get the Time axis from the variable list
taxisID = vlistInqTaxis(vlistID)
! Loop over the first 10 time steps
DO tsID = 0, 10
! Inquire the time step
status = streamInqTimestep(streamID, tsID)
! Get the verification date and time
vdate = taxisInqVdate(taxisID)
vtime = taxisInqVtime(taxisID)
! Read sst
CALL streamReadVarSlice(streamID, varID1, 0, sst, nmiss)
WRITE(*,*) vdate, minval(sst), maxval(sst)
END DO
! Close the input stream
CALL streamClose(streamID)
END
...@@ -8,3 +8,7 @@ g77 -g -I../src -o cdi_write_f cdi_write_f.f -L/pf/m/m214003/local/etch-ia32/lib ...@@ -8,3 +8,7 @@ g77 -g -I../src -o cdi_write_f cdi_write_f.f -L/pf/m/m214003/local/etch-ia32/lib
gfortran -g -o cdi_write_simple cdi_write_simple.f -I../src -L/Users/m214003/local/lib ../src/.libs/libcdi.a -L/Users/uwe/cdt/libs4cdo-0.0.9/build/lib -L/opt/local/lib -lgrib_api /Users/uwe/cdt/libs4cdo-0.0.9/build/lib/libjasper.dylib /Users/uwe/cdt/libs4cdo-0.0.9/build/lib/libnetcdf.dylib /opt/local/lib/libcurl.dylib /opt/local/lib/libidn.dylib /opt/local/lib/libintl.dylib -lc /opt/local/lib/libiconv.dylib -lssl -lcrypto /Users/uwe/cdt/libs4cdo-0.0.9/build/lib/libhdf5_hl.dylib /Users/uwe/cdt/libs4cdo-0.0.9/build/lib/libhdf5.dylib -lpthread /Users/uwe/cdt/libs4cdo-0.0.9/build/lib/libsz.dylib -lz -lm -pthread gfortran -g -o cdi_write_simple cdi_write_simple.f -I../src -L/Users/m214003/local/lib ../src/.libs/libcdi.a -L/Users/uwe/cdt/libs4cdo-0.0.9/build/lib -L/opt/local/lib -lgrib_api /Users/uwe/cdt/libs4cdo-0.0.9/build/lib/libjasper.dylib /Users/uwe/cdt/libs4cdo-0.0.9/build/lib/libnetcdf.dylib /opt/local/lib/libcurl.dylib /opt/local/lib/libidn.dylib /opt/local/lib/libintl.dylib -lc /opt/local/lib/libiconv.dylib -lssl -lcrypto /Users/uwe/cdt/libs4cdo-0.0.9/build/lib/libhdf5_hl.dylib /Users/uwe/cdt/libs4cdo-0.0.9/build/lib/libhdf5.dylib -lpthread /Users/uwe/cdt/libs4cdo-0.0.9/build/lib/libsz.dylib -lz -lm -pthread
gfortran -g -o cdi_read_sst cdi_read_sst.f -I../src ../src/.libs/libcdi.a -L/Users/m214003/local/gribapi-1.9.16/lib -lgrib_api /opt/local/lib/libjasper.dylib /opt/local/lib/libjpeg.dylib /opt/local/lib/libnetcdf.dylib /opt/local/lib/libhdf5_hl.dylib /opt/local/lib/libhdf5.dylib /opt/local/lib/libcurl.dylib /opt/local/lib/libidn.dylib /opt/local/lib/libintl.dylib -lc /opt/local/lib/libiconv.dylib -lssl -lcrypto /opt/local/lib/libsz.dylib -lz -lm -pthread
...@@ -490,7 +490,7 @@ int grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype ...@@ -490,7 +490,7 @@ int grb_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtype
int ljpeg_warn = 1; int ljpeg_warn = 1;
void *gc = NULL; void *gc = NULL;
if ( memtype == MEMTYPE_FLOAT ) Error("cdf_write_var_slice not implemented for memtype float!"); if ( memtype == MEMTYPE_FLOAT ) Error("grb_write_var_slice not implemented for memtype float!");
filetype = streamptr->filetype; filetype = streamptr->filetype;
fileID = streamptr->fileID; fileID = streamptr->fileID;
......
Markdown is supported
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