which .f90 file is to read netcdf file

Status
Not open for further replies.

liyongkang

liyongkang
New Member
I am a new for CLM and CESM. Now I want to read a new netcdf file(.nc) to memery to involve in CLM compute. So I want to know which .f90 file is to do it. Thanks!
It seems that the ncdio_pio.f90 file is to write the .nc file, but I want to read .nc file.
 

oleson

Keith Oleson
CSEG and Liaisons
Staff member
There are several examples of reading netcdf files in the CLM5 code. Look at UrbanParamsType.F90 for example.
There are a couple of "use ncdio_pio" statements that make available several ncdio_pio functions:

use ncdio_pio , only : file_desc_t, ncd_io, ncd_inqvdlen, ncd_inqfdims
use ncdio_pio , only : ncd_pio_openfile, ncd_pio_closefile, ncd_inqdid, ncd_inqdlen.

The file is opened using:

call ncd_pio_openfile (ncid, locfn, 0)

Variables are read in from the file using the "flag='read'", e.g.,

call ncd_io(ncid=ncid, varname='CANYON_HWR', flag='read', data=urbinp%canyon_hwr,&
dim1name=grlnd, readvar=readvar)

Then the file is closed using:

call ncd_pio_closefile(ncid)
 

liyongkang

liyongkang
New Member
There are several examples of reading netcdf files in the CLM5 code. Look at UrbanParamsType.F90 for example.
There are a couple of "use ncdio_pio" statements that make available several ncdio_pio functions:

use ncdio_pio , only : file_desc_t, ncd_io, ncd_inqvdlen, ncd_inqfdims
use ncdio_pio , only : ncd_pio_openfile, ncd_pio_closefile, ncd_inqdid, ncd_inqdlen.

The file is opened using:

call ncd_pio_openfile (ncid, locfn, 0)

Variables are read in from the file using the "flag='read'", e.g.,

call ncd_io(ncid=ncid, varname='CANYON_HWR', flag='read', data=urbinp%canyon_hwr,&
dim1name=grlnd, readvar=readvar)

Then the file is closed using:

call ncd_pio_closefile(ncid)
Thanks a lot! Now I achieve the goal by " use necdf ",but It's running a little slow. Then I would try the way that You suggested. Thanks agin, I a new about the cesm.
 
Status
Not open for further replies.
Back
Top