Program read_ncreal cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc cto Read netcdf file cby Thanh con 2011/12/29 cat HMO, Hanoi University of Science cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc implicit none include "netcdf.inc" c integer nx,ny,ntimes ! Lon, Lat, Time dimensions c modify nx,ny,ntimes according to the input netcdf file c use "ncdump -h ten_file.nc" to get those values. parameter (nx=360,ny=280,ntimes=1) c integer iret,fid integer id_lon,id_lat,id_var c character*128 cfiname !input filename character*128 cvrname !variable name integer nlen !n.of characters of cvrname c real rlon(nx),rlat(ny) real r3var(nx,ny,ntimes) cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c Read data with the variable name cvrname in the file cfiname c modify cfiname, cvrname cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc cfiname="hehe.nc" cvrname="onset" iret=nf_open(cfiname,nf_NoWrite,fid) c Read lonlat iret=nf_inq_varid(fid,'lon',id_lon) iret=nf_get_var_real(fid,id_lon,rlon) iret=nf_inq_varid(fid,'lat',id_lat) iret=nf_get_var_real(fid,id_lat,rlat) iret=nf_close(fid) c iret=nf_inq_varid(fid,cvrname,id_var) iret=nf_get_var_real(fid,id_var,r3var) iret=nf_close(fid) print*,rlon(1),rlat(1),r3var(1,1,1) end