dannymleung@ucla_edu
New Member
Hi--
I’m trying to put a .nc file into CLM for it to read and calculate physics in the dust module DUSTMod.F90. I changed namelist_definition.xml and user_nl_clm for reading the namelist_variable.
For namelist_definition_clm4_0.xml:
<!-- soil diameter -dmleung, 22 Apr 2020 -->
<entry id="soil_diam" type="char*256" input_pathname="abs" category="datasets"
group="clm_inparm" valid_values="" >
Full pathname of time-invariant soil diameter dataset for calculating dust saltation threshold.
</entry>
For user_nl_clm:
&clm_inparm
soil_diam='/glade/u/home/dleung/CESM/edit_namelist/soil_diameter-19x25-04222020.nc'
/
I guess I’m doing right above? I am then less certain about how to use PIO library to read the .nc file in DUSTMod.F90 like this (after doing use ncdio_pio, and defining all the needed parameters):
!-----------------------------------------------------------------------
! read in soil diameter dataset (and interpolate to CLM native grid?)
! by dmleung, 29 Apr 2020
call getfil(soil_diam, soil_diam_file, 0)
call ncd_pio_openfile (ncid, trim(soil_diam_file), PIO_NOWRITE)
! Get input data resolution.
ierr = pio_inq_dimid( ncid, 'lon', did )
ierr = pio_inq_dimlen( ncid, did, nlon )
ierr = pio_inq_dimid( ncid, 'lat', did )
ierr = pio_inq_dimlen( ncid, did, nlat )
allocate(dst_lons(nlon))
allocate(dst_lats(nlat))
allocate(soil_diameter_in(nlon,nlat))
ierr = pio_inq_varid( ncid, 'lon', vid )
ierr = pio_get_var( ncid, vid, dst_lons )
ierr = pio_inq_varid( ncid, 'lat', vid )
ierr = pio_get_var( ncid, vid, dst_lats )
ierr = pio_inq_varid( ncid, 'mbl_bsn_fct_geo', vid )
ierr = pio_get_var( ncid, vid, soil_diameter_in )
Am I doing right above? Moreover, I wonder if my dataset is a 2D (long by lat) static map, do I need to regrid the data to CLM native grid? I saw that CAM has interpolation functions like get_rlat_all_p, lininterp, etc. Are there any similar functions in CLM and what functions do I need to read and regrid the dataset?
I attached the detailed scripts, if needed. Any help is highly appreciated.
Many thanks,
Danny
I’m trying to put a .nc file into CLM for it to read and calculate physics in the dust module DUSTMod.F90. I changed namelist_definition.xml and user_nl_clm for reading the namelist_variable.
For namelist_definition_clm4_0.xml:
<!-- soil diameter -dmleung, 22 Apr 2020 -->
<entry id="soil_diam" type="char*256" input_pathname="abs" category="datasets"
group="clm_inparm" valid_values="" >
Full pathname of time-invariant soil diameter dataset for calculating dust saltation threshold.
</entry>
For user_nl_clm:
&clm_inparm
soil_diam='/glade/u/home/dleung/CESM/edit_namelist/soil_diameter-19x25-04222020.nc'
/
I guess I’m doing right above? I am then less certain about how to use PIO library to read the .nc file in DUSTMod.F90 like this (after doing use ncdio_pio, and defining all the needed parameters):
!-----------------------------------------------------------------------
! read in soil diameter dataset (and interpolate to CLM native grid?)
! by dmleung, 29 Apr 2020
call getfil(soil_diam, soil_diam_file, 0)
call ncd_pio_openfile (ncid, trim(soil_diam_file), PIO_NOWRITE)
! Get input data resolution.
ierr = pio_inq_dimid( ncid, 'lon', did )
ierr = pio_inq_dimlen( ncid, did, nlon )
ierr = pio_inq_dimid( ncid, 'lat', did )
ierr = pio_inq_dimlen( ncid, did, nlat )
allocate(dst_lons(nlon))
allocate(dst_lats(nlat))
allocate(soil_diameter_in(nlon,nlat))
ierr = pio_inq_varid( ncid, 'lon', vid )
ierr = pio_get_var( ncid, vid, dst_lons )
ierr = pio_inq_varid( ncid, 'lat', vid )
ierr = pio_get_var( ncid, vid, dst_lats )
ierr = pio_inq_varid( ncid, 'mbl_bsn_fct_geo', vid )
ierr = pio_get_var( ncid, vid, soil_diameter_in )
Am I doing right above? Moreover, I wonder if my dataset is a 2D (long by lat) static map, do I need to regrid the data to CLM native grid? I saw that CAM has interpolation functions like get_rlat_all_p, lininterp, etc. Are there any similar functions in CLM and what functions do I need to read and regrid the dataset?
I attached the detailed scripts, if needed. Any help is highly appreciated.
Many thanks,
Danny