orog_mask_tools  1.12.0
 All Data Structures Files Functions Variables Pages
lakefrac.F90 File Reference

Compute lake fraction and depth. More...

Go to the source code of this file.

Functions/Subroutines

subroutine cal_lake_frac_depth (lakestat, cs_lakestat, lakedpth, cs_lakedpth)
 Calculate lake fraction and depth on the model grid from high-resolution data. More...
 
subroutine include_exclude_lakes (lake_frac, land_frac, lake_depth, geolat, geolon, tile_num)
 Include Caspian Sea and Aral Sea if GLDB dataset is used, and exclude lakes in the coastal areas of Antarctica if MODIS dataset is used. More...
 
subroutine lake_cell_comp (lkst, lkdp, lake_ct, lake_avg_frac, lake_dpth_sum)
 Compute cumulatively the lake fraction and lake depth for a cell. More...
 
program lake_frac
 This program computes lake fraction and depth numbers for FV3 cubed sphere grid cells, from a high resolution lat/lon data set. More...
 
subroutine nc_opchk (stat, opname)
 Check NetCDF error code. More...
 
subroutine read_cubed_sphere_grid (res, grid)
 Read the latitude and longitude for a cubed-sphere grid from the 'grid' files. More...
 
subroutine read_cubed_sphere_reg_grid (res, grid, halo_depth, res_x, res_y)
 Read the latitude and longitude for a regional grid from the 'grid' file. More...
 
subroutine read_lakedata (lakedata_path, lake_stat, lake_dpth, nlat, nlon)
 Read a high-resolution lake depth dataset, and a corresponding lake status dataset which provides a status code on the reliability of each lake depth point. More...
 
subroutine write_lakedata_to_orodata (cs_res, cs_lakestat, cs_lakedpth)
 Write lake depth and fraction to an existing model orography file. More...
 
subroutine write_reg_lakedata_to_orodata (cs_res, tile_x_dim, tile_y_dim, cs_lakestat, cs_lakedpth)
 Write lake depth and fraction to an existing model orography file. More...
 

Detailed Description

Compute lake fraction and depth.

Author
Ning Wang

Definition in file lakefrac.F90.

Function/Subroutine Documentation

subroutine lake_frac::cal_lake_frac_depth ( integer*1, dimension(:), intent(in)  lakestat,
real, dimension(:), intent(out)  cs_lakestat,
integer*2, dimension(:), intent(in)  lakedpth,
real, dimension(:), intent(out)  cs_lakedpth 
)

Calculate lake fraction and depth on the model grid from high-resolution data.

Parameters
[in]lakestatHigh-resolution lake status code.
[in]lakedpthHigh-resolution lake depth.
[out]cs_lakestatLake fraction on the model grid.
[out]cs_lakedpthLake depth on the model grid.
Author
Ning Wang

Definition at line 170 of file lakefrac.F90.

References enclosure_cnvx(), find_limit(), and lake_cell_comp().

Referenced by lake_frac().

subroutine lake_frac::include_exclude_lakes ( real, dimension(cs_res*cs_res), intent(inout)  lake_frac,
real, dimension(cs_res*cs_res), intent(in)  land_frac,
real, dimension(cs_res*cs_res), intent(inout)  lake_depth,
real, dimension(cs_res*cs_res), intent(in)  geolat,
real, dimension(cs_res*cs_res), intent(in)  geolon,
integer, intent(in)  tile_num 
)

Include Caspian Sea and Aral Sea if GLDB dataset is used, and exclude lakes in the coastal areas of Antarctica if MODIS dataset is used.

Parameters
[in,out]lake_fraclake fraction array of the given tile.
[in,out]lake_depthlake depth array of the given tile.
[in]land_fracland fraction array of the given tile.
[in]geolatlatitude array of the given tile.
[in]geolonlongitude array of the given tile.
[in]tile_numtile number of the given tile.
Author
Ning Wang

Definition at line 1048 of file lakefrac.F90.

References lake_frac().

Referenced by write_lakedata_to_orodata(), and write_reg_lakedata_to_orodata().

subroutine lake_frac::lake_cell_comp ( integer*1, intent(in)  lkst,
integer*2, intent(in)  lkdp,
integer, intent(out)  lake_ct,
real*8, intent(out)  lake_avg_frac,
real*8, intent(out)  lake_dpth_sum 
)

Compute cumulatively the lake fraction and lake depth for a cell.

Parameters
[in]lkstlake status value from a grid point in the source data.
[in]lkdplake depth value from a grid point in the source data.
[out]lake_ctlake points number accumulated for the cell
[out]lake_avg_fraclake fraction value accumulated for the cell.
[out]lake_dpth_sumis the lake depth value accumulated for the cell.
Author
Ning Wang

Definition at line 384 of file lakefrac.F90.

Referenced by cal_lake_frac_depth().

program lake_frac ( )

This program computes lake fraction and depth numbers for FV3 cubed sphere grid cells, from a high resolution lat/lon data set.

Author
Ning Wang
Date
July 2018
  • Shan Sun, Aug. 2018: Added Caspian Sea and Aral Sea to the lake fraction and lake depth fields.
  • Shan Sun, Dec. 2018: Added round up and round down with respect to a numerical minimum value and a cut-off value, for lake fraction number.
  • Ning Wang, Apr. 2019: Extended the program to process the same lake data for FV3 stand-alone regional (SAR) model.
Returns
0 for success.

Definition at line 21 of file lakefrac.F90.

References cal_lake_frac_depth(), read_cubed_sphere_grid(), read_cubed_sphere_reg_grid(), read_lakedata(), write_lakedata_to_orodata(), and write_reg_lakedata_to_orodata().

Referenced by include_exclude_lakes(), makemt2(), read_mask(), tersub(), write_lakedata_to_orodata(), and write_reg_lakedata_to_orodata().

subroutine lake_frac::nc_opchk ( integer  stat,
character(len=*)  opname 
)

Check NetCDF error code.

Parameters
[in]statError code.
[in]opnameNetCDF operation that failed.
Author
Ning Wang

Definition at line 1111 of file lakefrac.F90.

subroutine lake_frac::read_cubed_sphere_grid ( integer, intent(in)  res,
real, dimension(:,:), intent(out)  grid 
)

Read the latitude and longitude for a cubed-sphere grid from the 'grid' files.

For global grids, all six sides are returned.

Parameters
[in]resThe resolution. Example: '96' for C96.
[out]gridArray containing the latitude and longitude on the 'supergrid'. Multiple tiles are concatenated.
Author
Ning Wang

Definition at line 423 of file lakefrac.F90.

References nc_opchk().

Referenced by lake_frac().

subroutine lake_frac::read_cubed_sphere_reg_grid ( integer, intent(in)  res,
real, dimension(:,:), intent(out), allocatable  grid,
integer, intent(in)  halo_depth,
integer, intent(out)  res_x,
integer, intent(out)  res_y 
)

Read the latitude and longitude for a regional grid from the 'grid' file.

Parameters
[in]resResolution of grid. Example: '96' for C96.
[out]gridLatitude and longitude on the supergrid.
[in]halo_depthLateral halo. Not used.
[out]res_xNumber of grid points in the 'x' direction.
[out]res_yNumber of grid points in the 'y' direction.
Author
Ning Wang

Definition at line 483 of file lakefrac.F90.

References nc_opchk().

Referenced by lake_frac().

subroutine lake_frac::read_lakedata ( character(len=256), intent(in)  lakedata_path,
integer*1, dimension(:), intent(out)  lake_stat,
integer*2, dimension(:), intent(out)  lake_dpth,
integer, intent(in)  nlat,
integer, intent(in)  nlon 
)

Read a high-resolution lake depth dataset, and a corresponding lake status dataset which provides a status code on the reliability of each lake depth point.

Parameters
[in]lakedata_pathPath to the lake depth and lake status dataset.
[out]lake_statStatus code.
[out]lake_dpthLake depth.
[in]nlat'j' dimension of both datasets.
[in]nlon'i' dimension of both datasets.

Definition at line 553 of file lakefrac.F90.

Referenced by lake_frac().

subroutine lake_frac::write_lakedata_to_orodata ( integer, intent(in)  cs_res,
real, dimension(:), intent(in)  cs_lakestat,
real, dimension(:), intent(in)  cs_lakedpth 
)

Write lake depth and fraction to an existing model orography file.

Also, perform some quality control checks on the lake data. This routine is used for non-regional grids.

Parameters
[in]cs_resResolution. Example: '96' for C96.
[in]cs_lakestatLake fraction.
[in]cs_lakedpthLake depth.
Author
Ning Wang

Definition at line 609 of file lakefrac.F90.

References include_exclude_lakes(), lake_frac(), and nc_opchk().

Referenced by lake_frac().

subroutine lake_frac::write_reg_lakedata_to_orodata ( integer, intent(in)  cs_res,
integer, intent(in)  tile_x_dim,
integer, intent(in)  tile_y_dim,
real, dimension(:), intent(in)  cs_lakestat,
real, dimension(:), intent(in)  cs_lakedpth 
)

Write lake depth and fraction to an existing model orography file.

Also, perform some quality control checks on the lake data. This routine is used for regional grids.

Parameters
[in]cs_resResolution. Example: '96' for C96.
[in]cs_lakestatLake fraction.
[in]cs_lakedpthLake depth.
[in]tile_x_dim'x' dimension of the model grid.
[in]tile_y_dim'y' dimension of the model grid.
Author
Ning Wang

Definition at line 826 of file lakefrac.F90.

References include_exclude_lakes(), lake_frac(), and nc_opchk().

Referenced by lake_frac().