5.13.3-dev0
mHM
The mesoscale Hydrological Model
Loading...
Searching...
No Matches
mo_read_spatial_data Module Reference

Reads spatial input data. More...

Data Types

interface  read_spatial_data_ascii
 Reads spatial data files of ASCII format. More...
 
interface  read_spatial_data_nc
 Reads spatial data files of nc format. More...
 
interface  read_spatial_data_nc_or_ascii
 Reads spatial data files of nc or ASCII format. More...
 

Functions/Subroutines

subroutine read_spatial_data_ascii_dp (filename, fileunit, header_ncols, header_nrows, header_xllcorner, header_yllcorner, header_cellsize, data, mask)
 TODO: add description.
 
subroutine read_spatial_data_ascii_i4 (filename, fileunit, header_ncols, header_nrows, header_xllcorner, header_yllcorner, header_cellsize, data, mask)
 TODO: add description.
 
subroutine, public read_header_ascii (filename, fileunit, header_ncols, header_nrows, header_xllcorner, header_yllcorner, header_cellsize, header_nodata)
 Reads header lines of ASCII files.
 
subroutine, public check_uniform_axis (var, cellsize, origin, increasing, tol)
 check if given axis is a uniform axis.
 
logical function is_x_axis (var)
 check if given variable is a x-axis.
 
logical function is_y_axis (var)
 check if given variable is a y-axis.
 
logical function is_lon_coord (var)
 check if given variable is a lon coordinate.
 
logical function is_lat_coord (var)
 check if given variable is a lat coordinate.
 
subroutine, public get_header_info_from_nc (nc, var, nx, ny, xll, yll, cellsize, mask)
 initialize grid from a netcdf dataset
 
subroutine read_spatial_data_nc_i4 (ncname, varname, data, maskout, ncols, nrows, xllcorner, yllcorner, cellsize, nodata_value)
 Read file from filepath.
 
subroutine read_spatial_data_nc_dp (ncname, varname, data, maskout, ncols, nrows, xllcorner, yllcorner, cellsize, nodata_value)
 Read file from filepath.
 
subroutine read_spatial_data_nc_or_ascii_dp (filepath, fileunit, header_ncols, header_nrows, header_xllcorner, header_yllcorner, header_cellsize, data, maskout, out_ncols, out_nrows, out_xllcorner, out_yllcorner, out_cellsize, out_nodata_value)
 Read file from filepath.
 
subroutine read_spatial_data_nc_or_ascii_i4 (filepath, fileunit, header_ncols, header_nrows, header_xllcorner, header_yllcorner, header_cellsize, data, maskout, out_ncols, out_nrows, out_xllcorner, out_yllcorner, out_cellsize, out_nodata_value)
 Read file from filepath.
 

Detailed Description

Reads spatial input data.

This module is to read spatial input data, e.g. dem, aspect, flow direction. The module provides a subroutine for ASCII files. (Subroutine for NetCDF files will come with release 5.1). The data are read from the specified directory.

Authors
Juliane Mai
Date
Dec 2012


Function/Subroutine Documentation

◆ check_uniform_axis()

subroutine, public mo_read_spatial_data::check_uniform_axis ( type(ncvariable), intent(in) var,
real(dp), intent(out), optional cellsize,
real(dp), intent(out), optional origin,
logical, intent(out), optional increasing,
real(dp), intent(in), optional tol )

check if given axis is a uniform axis.

Authors
Sebastian Müller
Date
Mar 2024
Parameters
[in]varNetCDF variable for corresponding axis
[out]cellsizecellsize of the uniform axis
[out]originorigin of the axis vertices
[out]increasingwhether the axis has increasing values
[in]toltolerance for cell size comparisson (default: 1.e-7)

Definition at line 469 of file mo_read_spatial_data.f90.

Referenced by get_header_info_from_nc().

Here is the caller graph for this function:

◆ get_header_info_from_nc()

subroutine, public mo_read_spatial_data::get_header_info_from_nc ( type(ncdataset), intent(in) nc,
character(*), intent(in) var,
integer(i4), intent(out) nx,
integer(i4), intent(out) ny,
real(dp), intent(out) xll,
real(dp), intent(out) yll,
real(dp), intent(out) cellsize,
logical, dimension(:,:), intent(out), optional, allocatable mask )

initialize grid from a netcdf dataset

initialize grid from a netcdf dataset and a reference variable.

Authors
Sebastian Müller
Date
Mar 2024
Parameters
[in]ncNetCDF Dataset
[in]varnc variable name to determine the grid from
[out]nxsize of the x coordinate
[out]nysize of the y coordinate
[out]xllx lower left corner
[out]ylly lower left corner

Definition at line 652 of file mo_read_spatial_data.f90.

References check_uniform_axis(), is_lat_coord(), is_lon_coord(), is_x_axis(), and is_y_axis().

Referenced by mo_read_spatial_data::read_spatial_data_nc::read_spatial_data_nc_dp(), and mo_read_spatial_data::read_spatial_data_nc::read_spatial_data_nc_i4().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_lat_coord()

logical function mo_read_spatial_data::is_lat_coord ( type(ncvariable), intent(in) var)
private

check if given variable is a lat coordinate.

Returns
logical :: is_lat_coord
Authors
Sebastian Müller
Date
Mar 2024
Parameters
[in]varNetCDF variable to check

Definition at line 620 of file mo_read_spatial_data.f90.

References is_lat_coord().

Referenced by get_header_info_from_nc(), and is_lat_coord().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_lon_coord()

logical function mo_read_spatial_data::is_lon_coord ( type(ncvariable), intent(in) var)
private

check if given variable is a lon coordinate.

Returns
logical :: is_lon_coord
Authors
Sebastian Müller
Date
Mar 2024
Parameters
[in]varNetCDF variable to check

Definition at line 588 of file mo_read_spatial_data.f90.

References is_lon_coord().

Referenced by get_header_info_from_nc(), and is_lon_coord().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_x_axis()

logical function mo_read_spatial_data::is_x_axis ( type(ncvariable), intent(in) var)
private

check if given variable is a x-axis.

Returns
logical :: is_x_axis
Authors
Sebastian Müller
Date
Mar 2024
Parameters
[in]varNetCDF variable to check

Definition at line 542 of file mo_read_spatial_data.f90.

References is_x_axis().

Referenced by get_header_info_from_nc(), and is_x_axis().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_y_axis()

logical function mo_read_spatial_data::is_y_axis ( type(ncvariable), intent(in) var)
private

check if given variable is a y-axis.

Returns
logical :: is_y_axis
Authors
Sebastian Müller
Date
Mar 2024
Parameters
[in]varNetCDF variable to check

Definition at line 565 of file mo_read_spatial_data.f90.

References is_y_axis().

Referenced by get_header_info_from_nc(), and is_y_axis().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_header_ascii()

subroutine, public mo_read_spatial_data::read_header_ascii ( character(len = *), intent(in) filename,
integer(i4), intent(in) fileunit,
integer(i4), intent(out) header_ncols,
integer(i4), intent(out) header_nrows,
real(dp), intent(out) header_xllcorner,
real(dp), intent(out) header_yllcorner,
real(dp), intent(out) header_cellsize,
real(dp), intent(out) header_nodata )

Reads header lines of ASCII files.

Reads header lines of ASCII files, e.g. dem, aspect, flow direction.

Parameters
[in]character(len = *) :: filenameName of file and its location
[in]integer(i4) :: fileunitFile unit for open file
[out]integer(i4) :: header_nColsReference number of columns
[out]integer(i4) :: header_nRowsReference number of rows
[out]real(dp) :: header_xllcornerReference lower left corner (x)
[out]real(dp) :: header_yllcornerReference lower left corner (y)
[out]real(dp) :: header_cellsizeReference cell size [m]
[out]real(dp) :: header_nodataReference nodata value
Authors
Juliane Mai
Date
Jan 2013

Definition at line 417 of file mo_read_spatial_data.f90.

References mo_common_constants::nodata_dp.

Referenced by mo_meteo_handler::init_level2(), mo_common_read_data::read_dem(), mo_read_spatial_data::read_spatial_data_ascii::read_spatial_data_ascii_dp(), mo_read_spatial_data::read_spatial_data_ascii::read_spatial_data_ascii_i4(), mo_read_spatial_data::read_spatial_data_nc_or_ascii::read_spatial_data_nc_or_ascii_dp(), and mo_read_spatial_data::read_spatial_data_nc_or_ascii::read_spatial_data_nc_or_ascii_i4().

Here is the caller graph for this function:

◆ read_spatial_data_ascii_dp()

subroutine mo_read_spatial_data::read_spatial_data_ascii_dp ( character(len = *), intent(in) filename,
integer(i4), intent(in) fileunit,
integer(i4), intent(in) header_ncols,
integer(i4), intent(in) header_nrows,
real(dp), intent(in) header_xllcorner,
real(dp), intent(in) header_yllcorner,
real(dp), intent(in) header_cellsize,
real(dp), dimension(:, :), intent(out), allocatable data,
logical, dimension(:, :), intent(out), allocatable mask )
private

TODO: add description.

TODO: add description

Parameters
[in]character(len = *) :: filenamefilename with location
[in]integer(i4) :: fileunitunit for opening the file
[in]integer(i4) :: header_nColsnumber of columns of data fields:
[in]integer(i4) :: header_nRowsnumber of rows of data fields:
[in]real(dp) :: header_xllcornerheader read in lower left corner
[in]real(dp) :: header_yllcornerheader read in lower left corner
[in]real(dp) :: header_cellsizeheader read in cellsize
[out]real(dp), dimension(:, :) :: datadata
[out]logical, dimension(:, :) :: maskmask
Authors
Robert Schweppe
Date
Jun 2018

Definition at line 136 of file mo_read_spatial_data.f90.

◆ read_spatial_data_ascii_i4()

subroutine mo_read_spatial_data::read_spatial_data_ascii_i4 ( character(len = *), intent(in) filename,
integer(i4), intent(in) fileunit,
integer(i4), intent(in) header_ncols,
integer(i4), intent(in) header_nrows,
real(dp), intent(in) header_xllcorner,
real(dp), intent(in) header_yllcorner,
real(dp), intent(in) header_cellsize,
integer(i4), dimension(:, :), intent(out), allocatable data,
logical, dimension(:, :), intent(out), allocatable mask )
private

TODO: add description.

TODO: add description

Parameters
[in]character(len = *) :: filenamefilename with location
[in]integer(i4) :: fileunitunit for opening the file
[in]integer(i4) :: header_nColsnumber of columns of data fields:
[in]integer(i4) :: header_nRowsnumber of rows of data fields:
[in]real(dp) :: header_xllcornerheader read in lower left corner
[in]real(dp) :: header_yllcornerheader read in lower left corner
[in]real(dp) :: header_cellsizeheader read in cellsize
[out]integer(i4), dimension(:, :) :: datadata
[out]logical, dimension(:, :) :: maskmask
Authors
Robert Schweppe
Date
Jun 2018

Definition at line 276 of file mo_read_spatial_data.f90.

◆ read_spatial_data_nc_dp()

subroutine mo_read_spatial_data::read_spatial_data_nc_dp ( character(len=*), intent(in) ncname,
character(len=*), intent(in) varname,
real(dp), dimension(:, :), intent(out), allocatable data,
logical, dimension(:, :), intent(out), optional, allocatable maskout,
integer(i4), intent(out) ncols,
integer(i4), intent(out) nrows,
real(dp), intent(out) xllcorner,
real(dp), intent(out) yllcorner,
real(dp), intent(out) cellsize,
real(dp), intent(out) nodata_value )
private

Read file from filepath.

If there is a nc file with the correct name it is prefered over the asci file.

TODO: add description

Authors
Simon Lüdke
Date
June 2025

Definition at line 824 of file mo_read_spatial_data.f90.

◆ read_spatial_data_nc_i4()

subroutine mo_read_spatial_data::read_spatial_data_nc_i4 ( character(len=*), intent(in) ncname,
character(len=*), intent(in) varname,
integer(i4), dimension(:, :), intent(out), allocatable data,
logical, dimension(:, :), intent(out), optional, allocatable maskout,
integer(i4), intent(out) ncols,
integer(i4), intent(out) nrows,
real(dp), intent(out) xllcorner,
real(dp), intent(out) yllcorner,
real(dp), intent(out) cellsize,
real(dp), intent(out) nodata_value )
private

Read file from filepath.

If there is a nc file with the correct name it is prefered over the asci file.

TODO: add description

Authors
Simon Lüdke
Date
June 2025

Definition at line 764 of file mo_read_spatial_data.f90.

◆ read_spatial_data_nc_or_ascii_dp()

subroutine mo_read_spatial_data::read_spatial_data_nc_or_ascii_dp ( character(len = *), intent(in) filepath,
integer(i4), intent(in) fileunit,
integer(i4), intent(in) header_ncols,
integer(i4), intent(in) header_nrows,
real(dp), intent(in) header_xllcorner,
real(dp), intent(in) header_yllcorner,
real(dp), intent(in) header_cellsize,
real(dp), dimension(:, :), intent(out), allocatable data,
logical, dimension(:, :), intent(out), optional, allocatable maskout,
integer(i4), intent(out), optional out_ncols,
integer(i4), intent(out), optional out_nrows,
real(dp), intent(out), optional out_xllcorner,
real(dp), intent(out), optional out_yllcorner,
real(dp), intent(out), optional out_cellsize,
real(dp), intent(out), optional out_nodata_value )
private

Read file from filepath.

If there is a nc file with the correct name it is prefered over the asci file.

TODO: add description

Authors
Simon Lüdke
Date
June 2025

Definition at line 884 of file mo_read_spatial_data.f90.

◆ read_spatial_data_nc_or_ascii_i4()

subroutine mo_read_spatial_data::read_spatial_data_nc_or_ascii_i4 ( character(len = *), intent(in) filepath,
integer(i4), intent(in) fileunit,
integer(i4), intent(in) header_ncols,
integer(i4), intent(in) header_nrows,
real(dp), intent(in) header_xllcorner,
real(dp), intent(in) header_yllcorner,
real(dp), intent(in) header_cellsize,
integer(i4), dimension(:, :), intent(out), allocatable data,
logical, dimension(:, :), intent(out), optional, allocatable maskout,
integer(i4), intent(out), optional out_ncols,
integer(i4), intent(out), optional out_nrows,
real(dp), intent(out), optional out_xllcorner,
real(dp), intent(out), optional out_yllcorner,
real(dp), intent(out), optional out_cellsize,
real(dp), intent(out), optional out_nodata_value )
private

Read file from filepath.

If there is a nc file with the correct name it is prefered over the asci file.

TODO: add description

Authors
Simon Lüdke
Date
June 2025

Definition at line 1002 of file mo_read_spatial_data.f90.