global_cycle  1.13.0
read_write_data Module Reference

This module contains routines that read and write data. More...

Data Types

type  nsst_data
 

Functions/Subroutines

subroutine, public get_dim_nc (filename, nlat, nlon)
 Get the i/j dimensions of the data from a NetCDF file. More...
 
subroutine, public get_tf_clm_dim (file_sst, mlat_sst, mlon_sst)
 Get the i/j dimensions of RTG SST climatology file. More...
 
subroutine nc_check (status)
 Check the NetCDF status code. More...
 
subroutine netcdf_err (ERR, STRING)
 If a NetCDF call returns an error, print out a user-supplied message and the NetCDF library message. More...
 
subroutine, public read_data (LSOIL, LENSFC, DO_NSST, INC_FILE, IS_NOAHMP, TSFFCS, SMCFCS, SWEFCS, STCFCS, TG3FCS, ZORFCS, CVFCS, CVBFCS, CVTFCS, ALBFCS, VEGFCS, SLIFCS, CNPFCS, F10M, VETFCS, SOTFCS, ALFFCS, USTAR, FMM, FHH, SIHFCS, SICFCS, SITFCS, TPRCP, SRFLAG, SNDFCS, VMNFCS, VMXFCS, SLCFCS, SLPFCS, ABSFCS, T2M, Q2M, SLMASK, ZSOIL, NSST)
 Read the first guess surface records and nsst records (if selected) for a single cubed-sphere tile. More...
 
subroutine, public read_gsi_data (GSI_FILE, FILE_TYPE, LSOIL)
 Read increment file from the GSI containing either the foundation temperature increments and mask, or the soil increments. More...
 
subroutine, public read_lat_lon_orog (RLA, RLO, OROG, OROG_UF, TILE_NUM, IDIM, JDIM, IJDIM, LANDFRAC)
 Read latitude and longitude for the cubed-sphere tile from the 'grid' file. More...
 
subroutine, public read_salclm_gfs_nc (filename, sal, xlats, xlons, nlat, nlon, itime)
 Read the woa05 salinity monthly climatology file. More...
 
subroutine, public read_tf_clim_grb (file_sst, sst, rlats_sst, rlons_sst, mlat_sst, mlon_sst, mon)
 Read a GRIB1 sst climatological analysis file. More...
 
subroutine remove_checksum (ncid, id_var)
 Remove the checksum attribute from a netcdf record. More...
 
subroutine, public write_data (lensfc, idim, jdim, lsoil, do_nsst, nsst, slifcs, tsffcs, vegfcs, swefcs, tg3fcs, zorfcs, albfcs, alffcs, cnpfcs, f10m, t2m, q2m, vetfcs, sotfcs, ustar, fmm, fhh, sicfcs, sihfcs, sitfcs, tprcp, srflag, swdfcs, vmnfcs, vmxfcs, slpfcs, absfcs, slcfcs, smcfcs, stcfcs)
 Update surface records - and nsst records if selected - on a single cubed-sphere tile to a pre-existing model restart file (in netcdf). More...
 

Variables

real, dimension(:,:), allocatable, public dtref_gaus
 GSI foundation temperature increment on the gaussian grid. More...
 
integer, public idim_gaus
 'i' dimension of GSI gaussian grid. More...
 
integer, public jdim_gaus
 'j' dimension of GSI gaussian grid. More...
 
real, dimension(:,:,:), allocatable, public slc_inc_gaus
 GSI soil moisture increments on the gaussian grid. More...
 
integer, dimension(:,:), allocatable, public slmsk_gaus
 GSI land mask on the gaussian grid. More...
 
integer, dimension(:,:), allocatable, public soilsnow_gaus
 GSI soil / snow mask for land on the gaussian grid. More...
 
real, dimension(:,:,:), allocatable, public stc_inc_gaus
 GSI soil temperature increments on the gaussian grid. More...
 

Detailed Description

This module contains routines that read and write data.

Author
Xu Li, Hang Lei, George Gayno NOAA/EMC

Data Type Documentation

◆ read_write_data::nsst_data

type read_write_data::nsst_data

Definition at line 16 of file read_write_data.f90.

Data Fields
real, dimension(:), allocatable c_0
real, dimension(:), allocatable c_d
real, dimension(:), allocatable d_conv
real, dimension(:), allocatable dt_cool
real, dimension(:), allocatable ifd
real, dimension(:), allocatable qrain
real, dimension(:), allocatable tfinc
real, dimension(:), allocatable tref
real, dimension(:), allocatable w_0
real, dimension(:), allocatable w_d
real, dimension(:), allocatable xs
real, dimension(:), allocatable xt
real, dimension(:), allocatable xtts
real, dimension(:), allocatable xu
real, dimension(:), allocatable xv
real, dimension(:), allocatable xz
real, dimension(:), allocatable xzts
real, dimension(:), allocatable z_c
real, dimension(:), allocatable zm

Function/Subroutine Documentation

◆ get_dim_nc()

subroutine, public read_write_data::get_dim_nc ( character (len=*), intent(in)  filename,
integer, intent(out)  nlat,
integer, intent(out)  nlon 
)

Get the i/j dimensions of the data from a NetCDF file.

Parameters
[in]filenameName of the file to be read.
[out]nlat'j' dimension of the data in the file.
[out]nlon'i' dimension of the data in the file.
Author
Xu Li NOAA/EMC

Definition at line 1825 of file read_write_data.f90.

References nc_check().

Referenced by get_sal_clm().

◆ get_tf_clm_dim()

subroutine, public read_write_data::get_tf_clm_dim ( character(*), intent(in)  file_sst,
integer, intent(out)  mlat_sst,
integer, intent(out)  mlon_sst 
)

Get the i/j dimensions of RTG SST climatology file.

The file is GRIB1.

Parameters
[in]file_sstFile name of the sst file.
[in]mlat_sstThe 'j' dimension of the data.
[in]mlon_sstThe 'i' dimension of the data.
Author
Xu Li NOAA/EMC
Date
2019-03-13

Definition at line 1696 of file read_write_data.f90.

Referenced by get_tf_clm().

◆ nc_check()

subroutine read_write_data::nc_check ( integer, intent(in)  status)

Check the NetCDF status code.

If there is an error, print the library error message and stop processing.

Parameters
[in]statusNetCDF status code.
Author
Xu Li NOAA/EMC

Definition at line 1862 of file read_write_data.f90.

Referenced by get_dim_nc(), and read_salclm_gfs_nc().

◆ netcdf_err()

subroutine read_write_data::netcdf_err ( integer, intent(in)  ERR,
character(len=*), intent(in)  STRING 
)

If a NetCDF call returns an error, print out a user-supplied message and the NetCDF library message.

Then stop processing.

Parameters
[in]ERRNetCDF error code.
[in]STRINGUser-defined error message.
Author
George Gayno NOAA/EMC

Definition at line 825 of file read_write_data.f90.

Referenced by read_data(), read_gsi_data(), read_lat_lon_orog(), remove_checksum(), and write_data().

◆ read_data()

subroutine, public read_write_data::read_data ( integer, intent(in)  LSOIL,
integer, intent(in)  LENSFC,
logical, intent(in)  DO_NSST,
logical, intent(in)  INC_FILE,
logical, intent(out), optional  IS_NOAHMP,
real, dimension(lensfc), intent(out), optional  TSFFCS,
real, dimension(lensfc,lsoil), intent(out), optional  SMCFCS,
real, dimension(lensfc), intent(out), optional  SWEFCS,
real, dimension(lensfc,lsoil), intent(out), optional  STCFCS,
real, dimension(lensfc), intent(out), optional  TG3FCS,
real, dimension(lensfc), intent(out), optional  ZORFCS,
real, dimension(lensfc), intent(out), optional  CVFCS,
real, dimension(lensfc), intent(out), optional  CVBFCS,
real, dimension(lensfc), intent(out), optional  CVTFCS,
real, dimension(lensfc,4), intent(out), optional  ALBFCS,
real, dimension(lensfc), intent(out), optional  VEGFCS,
real, dimension(lensfc), intent(out), optional  SLIFCS,
real, dimension(lensfc), intent(out), optional  CNPFCS,
real, dimension(lensfc), intent(out), optional  F10M,
real, dimension(lensfc), intent(out), optional  VETFCS,
real, dimension(lensfc), intent(out), optional  SOTFCS,
real, dimension(lensfc,2), intent(out), optional  ALFFCS,
real, dimension(lensfc), intent(out), optional  USTAR,
real, dimension(lensfc), intent(out), optional  FMM,
real, dimension(lensfc), intent(out), optional  FHH,
real, dimension(lensfc), intent(out), optional  SIHFCS,
real, dimension(lensfc), intent(out), optional  SICFCS,
real, dimension(lensfc), intent(out), optional  SITFCS,
real, dimension(lensfc), intent(out), optional  TPRCP,
real, dimension(lensfc), intent(out), optional  SRFLAG,
real, dimension(lensfc), intent(out), optional  SNDFCS,
real, dimension(lensfc), intent(out), optional  VMNFCS,
real, dimension(lensfc), intent(out), optional  VMXFCS,
real, dimension(lensfc,lsoil), intent(out), optional  SLCFCS,
real, dimension(lensfc), intent(out), optional  SLPFCS,
real, dimension(lensfc), intent(out), optional  ABSFCS,
real, dimension(lensfc), intent(out), optional  T2M,
real, dimension(lensfc), intent(out), optional  Q2M,
real, dimension(lensfc), intent(out), optional  SLMASK,
real(kind=4), dimension(lsoil), intent(out), optional  ZSOIL,
type(nsst_data), optional  NSST 
)

Read the first guess surface records and nsst records (if selected) for a single cubed-sphere tile.

Parameters
[in]LSOILNumber of soil layers.
[in]LENSFCTotal number of points on a tile.
[in]DO_NSSTWhen true, nsst fields are read.
[in]INC_FILEWhen true, read from an increment file. False reads from a restart file.
[out]IS_NOAHMPWhen true, process for the Noah-MP LSM.
[out]TSFFCSSkin Temperature.
[out]SMCFCSTotal volumetric soil moisture.
[out]SWEFCSSnow water equivalent.
[out]STCFCSSoil temperature.
[out]TG3FCSSoil substrate temperature.
[out]ZORFCSRoughness length.
[out]CVFCSCloud cover.
[out]CVBFCSCloud base.
[out]CVTFCSCloud top.
[out]ALBFCSSnow-free albedo.
[out]SLIFCSLand-sea mask including ice flag.
[out]VEGFCSVegetation greenness.
[out]CNPFCSPlant canopy moisture content.
[out]F10Mlog((z0+10)/z0). See model routine sfc_diff.f for details.
[out]VETFCSVegetation type.
[out]SOTFCSSoil type.
[out]ALFFCSFractional coverage for strong/weak zenith angle dependent albedo.
[out]USTARFriction velocity.
[out]FMMlog((z0+z1)/z0). See model routine sfc_diff.f for details.
[out]FHHlog((ztmax+z1)/ztmax). See model routine sfc_diff.f for details.
[out]SIHFCSSea ice depth.
[out]SICFCSSea ice concentration.
[out]SITFCSSea ice temperature.
[out]TPRCPPrecipitation.
[out]SRFLAGSnow/rain flag.
[out]SNDFCSSnow depth.
[out]VMNFCSMinimum vegetation greenness.
[out]VMXFCSMaximum vegetation greenness.
[out]SLCFCSLiquid portion of volumetric soil moisture.
[out]SLPFCSSlope type.
[out]ABSFCSMaximum snow albedo.
[out]T2MTwo-meter air temperature.
[out]Q2MTwo-meter specific humidity.
[out]SLMASKLand-sea mask without ice flag.
[out]ZSOILSoil layer thickness.
[out]NSSTData structure containing nsst fields.
Author
George Gayno NOAA/EMC

Definition at line 1041 of file read_write_data.f90.

References netcdf_err().

Referenced by sfcdrv().

◆ read_gsi_data()

subroutine, public read_write_data::read_gsi_data ( character(len=*), intent(in)  GSI_FILE,
character(len=3), intent(in)  FILE_TYPE,
integer, intent(in), optional  LSOIL 
)

Read increment file from the GSI containing either the foundation temperature increments and mask, or the soil increments.

The data is in NetCDF and on a gaussian grid. The grid contains two extra rows for each pole. The interpolation from gaussian to native grid assumes no pole points, so these are removed.

Parameters
[in]GSI_FILEPath/name of the GSI file to be read.
[in]FILE_TYPEfile-type to be read in, 'NST' or 'LND'.
[in]LSOILNumber of model soil levels.
Author
George Gayno NOAA/EMC

Definition at line 858 of file read_write_data.f90.

References dtref_gaus, idim_gaus, jdim_gaus, netcdf_err(), slc_inc_gaus, slmsk_gaus, soilsnow_gaus, and stc_inc_gaus.

Referenced by sfcdrv().

◆ read_lat_lon_orog()

subroutine, public read_write_data::read_lat_lon_orog ( real, dimension(ijdim), intent(out)  RLA,
real, dimension(ijdim), intent(out)  RLO,
real, dimension(ijdim), intent(out)  OROG,
real, dimension(ijdim), intent(out)  OROG_UF,
character(len=5), intent(out)  TILE_NUM,
integer, intent(in)  IDIM,
integer, intent(in)  JDIM,
integer, intent(in)  IJDIM,
real(kind=kind_io8), dimension(ijdim), intent(out), optional  LANDFRAC 
)

Read latitude and longitude for the cubed-sphere tile from the 'grid' file.

Read the filtered and unfiltered orography and optionally the land fraction from the 'orography' file.

Parameters
[in]IDIM'i' dimension of cubed-sphere tile.
[in]JDIM'j' dimension of cubed-sphere tile.
[in]IJDIMTotal number of points on the cubed-sphere tile.
[out]RLALatitude on the cubed-sphere tile.
[out]RLOLongitude on the cubed-sphere tile.
[out]OROGFiltered orography.
[out]OROG_UFUnfiltered orography.
[out]TILE_NUMCubed-sphere tile number
[out]LANDFRACLand fraction.
Author
George Gayno NOAA/EMC

Definition at line 682 of file read_write_data.f90.

References netcdf_err().

Referenced by sfcdrv().

◆ read_salclm_gfs_nc()

subroutine, public read_write_data::read_salclm_gfs_nc ( character (len=*), intent(in)  filename,
real, dimension(nlon,nlat), intent(out)  sal,
real, dimension(nlat), intent(out)  xlats,
real, dimension(nlon), intent(out)  xlons,
integer, intent(in)  nlat,
integer, intent(in)  nlon,
integer, intent(in)  itime 
)

Read the woa05 salinity monthly climatology file.

The file is NetCDF.

Parameters
[in]filenameThe name of the climatology file.
[in]nlatThe 'j' dimension of the data in the file.
[in]nlonThe 'i' dimension of the data in the file.
[in]itimeThe monthly record to read.
[out]xlatsThe latitude of the data points.
[out]xlonsThe longitude of the data points.
[out]salThe salinity.
Author
Xu Li NOAA/EMC

Definition at line 1754 of file read_write_data.f90.

References nc_check().

Referenced by get_sal_clm_ta().

◆ read_tf_clim_grb()

subroutine, public read_write_data::read_tf_clim_grb ( character(*), intent(in)  file_sst,
real, dimension(mlon_sst,mlat_sst), intent(out)  sst,
real, dimension(mlat_sst), intent(out)  rlats_sst,
real, dimension(mlon_sst), intent(out)  rlons_sst,
integer, intent(in)  mlat_sst,
integer, intent(in)  mlon_sst,
integer, intent(in)  mon 
)

Read a GRIB1 sst climatological analysis file.

Read the sst analysis and save it as an expanded and transposed array.

Note
The data is stored from north to south, but this routine flips the poles.
Parameters
[in]file_sstFile name of the sst file.
[in]mlat_sst'j' dimension of the sst data.
[in]mlon_sst'i' dimension of the sst data.
[in]monThe month of the year.
[out]sstThe sst analysis data.
[out]rlats_sstThe latitudes of the sst data points.
[out]rlons_sstThe longitudes of the sst data points.
Author
Xu Li NOAA/EMC
Date
2019-03-13

Definition at line 1554 of file read_write_data.f90.

Referenced by get_tf_clm_ta().

◆ remove_checksum()

subroutine read_write_data::remove_checksum ( integer, intent(in)  ncid,
integer, intent(in)  id_var 
)

Remove the checksum attribute from a netcdf record.

Parameters
[in]ncidnetcdf file id
[in]id_varnetcdf variable id.
Author
George Gayno NCEP/EMC

Definition at line 642 of file read_write_data.f90.

References netcdf_err().

Referenced by write_data().

◆ write_data()

subroutine, public read_write_data::write_data ( integer, intent(in)  lensfc,
integer, intent(in)  idim,
integer, intent(in)  jdim,
integer, intent(in)  lsoil,
logical, intent(in)  do_nsst,
type(nsst_data), intent(in)  nsst,
real, dimension(lensfc), intent(in), optional  slifcs,
real, dimension(lensfc), intent(in), optional  tsffcs,
real, dimension(lensfc), intent(in), optional  vegfcs,
real, dimension(lensfc), intent(in), optional  swefcs,
real, dimension(lensfc), intent(in), optional  tg3fcs,
real, dimension(lensfc), intent(in), optional  zorfcs,
real, dimension(lensfc,4), intent(in), optional  albfcs,
real, dimension(lensfc,2), intent(in), optional  alffcs,
real, dimension(lensfc), intent(in), optional  cnpfcs,
real, dimension(lensfc), intent(in), optional  f10m,
real, dimension(lensfc), intent(in), optional  t2m,
real, dimension(lensfc), intent(in), optional  q2m,
real, dimension(lensfc), intent(in), optional  vetfcs,
real, dimension(lensfc), intent(in), optional  sotfcs,
real, dimension(lensfc), intent(in), optional  ustar,
real, dimension(lensfc), intent(in), optional  fmm,
real, dimension(lensfc), intent(in), optional  fhh,
real, dimension(lensfc), intent(in), optional  sicfcs,
real, dimension(lensfc), intent(in), optional  sihfcs,
real, dimension(lensfc), intent(in), optional  sitfcs,
real, dimension(lensfc), intent(in), optional  tprcp,
real, dimension(lensfc), intent(in), optional  srflag,
real, dimension(lensfc), intent(in), optional  swdfcs,
real, dimension(lensfc), intent(in), optional  vmnfcs,
real, dimension(lensfc), intent(in), optional  vmxfcs,
real, dimension(lensfc), intent(in), optional  slpfcs,
real, dimension(lensfc), intent(in), optional  absfcs,
real, dimension(lensfc,lsoil), intent(in), optional  slcfcs,
real, dimension(lensfc,lsoil), intent(in), optional  smcfcs,
real, dimension(lensfc,lsoil), intent(in), optional  stcfcs 
)

Update surface records - and nsst records if selected - on a single cubed-sphere tile to a pre-existing model restart file (in netcdf).

Note
The model restart files contain an additional snow field - snow cover (snocvr). That field is required for bit identical reproducability. If that record does not exist, the model will compute it as an initialization step. Because this program does not contain the snow cover algorithm, it will let the model compute it.
Parameters
[in]idim'i' dimension of a tile.
[in]jdim'j' dimension of a tile.
[in]lensfcTotal number of points on a tile.
[in]lsoilNumber of soil layers.
[in]do_nsstWhen true, nsst fields were processed.
[in]nsstData structure containing nsst fields.
[in]slifcsLand-sea mask.
[in]tsffcsSkin temperature.
[in]vegfcsVegetation greenness.
[in]swefcsSnow water equivalent
[in]tg3fcsSoil substrate temperature.
[in]zorfcsRoughness length.
[in]albfcsSnow-free albedo.
[in]alffcsFractional coverage for strong/weak zenith angle dependent albedo.
[in]cnpfcsPlant canopy moisture content.
[in]f10mlog((z0+10)/z0). See model routine sfc_diff.f for details.
[in]t2mTwo-meter air temperature.
[in]q2mTwo-meter specific humidity.
[in]vetfcsVegetation type.
[in]sotfcsSoil type.
[in]ustarFriction velocity.
[in]fmmlog((z0+z1)/z0). See model routine sfc_diff.f for details.
[in]fhhlog(ztmax+z1)/ztmax). See model routine sfc_diff.f for details.
[in]sicfcsSea ice concentraton.
[in]sihfcsSea ice depth.
[in]sitfcsSea ice temperature.
[in]tprcpPrecipitation.
[in]srflagSnow/rain flag.
[in]swdfcsPhysical snow depth.
[in]vmnfcsMinimum vegetation greenness.
[in]vmxfcsMaximum vegetation greenness.
[in]slpfcsSlope type.
[in]absfcsMaximum snow albedo.
[in]slcfcsLiquid portion of volumetric soil moisture.
[in]smcfcsTotal volumetric soil moisture.
[in]stcfcsSoil temperature.
Author
George Gayno NOAA/EMC

Definition at line 128 of file read_write_data.f90.

References netcdf_err(), and remove_checksum().

Referenced by sfcdrv().

Variable Documentation

◆ dtref_gaus

real, dimension(:,:), allocatable, public read_write_data::dtref_gaus

GSI foundation temperature increment on the gaussian grid.

Definition at line 49 of file read_write_data.f90.

Referenced by adjust_nsst(), and read_gsi_data().

◆ idim_gaus

integer, public read_write_data::idim_gaus

'i' dimension of GSI gaussian grid.

Definition at line 38 of file read_write_data.f90.

Referenced by land_increments::add_increment_soil(), adjust_nsst(), and read_gsi_data().

◆ jdim_gaus

integer, public read_write_data::jdim_gaus

'j' dimension of GSI gaussian grid.

Definition at line 40 of file read_write_data.f90.

Referenced by land_increments::add_increment_soil(), adjust_nsst(), and read_gsi_data().

◆ slc_inc_gaus

real, dimension(:,:,:), allocatable, public read_write_data::slc_inc_gaus

GSI soil moisture increments on the gaussian grid.

Definition at line 55 of file read_write_data.f90.

Referenced by land_increments::add_increment_soil(), and read_gsi_data().

◆ slmsk_gaus

integer, dimension(:,:), allocatable, public read_write_data::slmsk_gaus

GSI land mask on the gaussian grid.

Definition at line 42 of file read_write_data.f90.

Referenced by adjust_nsst(), and read_gsi_data().

◆ soilsnow_gaus

integer, dimension(:,:), allocatable, public read_write_data::soilsnow_gaus

GSI soil / snow mask for land on the gaussian grid.

1 - soil, 2 - snow, 0 - not land

Definition at line 45 of file read_write_data.f90.

Referenced by land_increments::add_increment_soil(), and read_gsi_data().

◆ stc_inc_gaus

real, dimension(:,:,:), allocatable, public read_write_data::stc_inc_gaus

GSI soil temperature increments on the gaussian grid.

Definition at line 52 of file read_write_data.f90.

Referenced by land_increments::add_increment_soil(), and read_gsi_data().