TableLib Module

History

current version 1.3 - 17th April 2024

version date comment
1.0 1/Oct/2008 Original code
1.1 4/Jan/2011 Read table specifing an id
1.2 8/Apr/2023 comments reformatted to adhere FORD specs.
1.3 17/Apr/2024 new public function TablesGetIds

License

license: GNU GPL http://www.gnu.org/licenses/

This file is part of

MOSAICO -- MOdular library for raSter bAsed hydrologIcal appliCatiOn.

Copyright (C) 2011 Giovanni Ravazzani

Code Description

Language: Fortran 90.

Software Standards: "European Standards for Writing and
Documenting Exchangeable Fortran 90 Code".

Module Description:

Module for managing tables Tables are stored in plain text. One single file may contain more than one table. Example of a table:

 Table Start
  Title: Stage discharge relatioship. #inline comment
  Id: Tab01 # mandatory

  # This is a sample comment.  You can put anything you want
  # on comment lines. Comment lines can be put everywhere

  Columns:    [Stage]        [Discharge]      [Method]
  Units:     [m a.s.l.]         [m3/s]          [-]
              300.0             10.0          measure
              300.5             20.0          measure
              301.0             50.0          measure
              301.5             100.0         extrapolation
              302.0             200.0         extrapolation
              302.5             500.0         extrapolation
  # another comment
 Table End

Example program:

 PROGRAM TestTableLib

 USE TableLib
 USE DataTypeSizes

 TYPE (TableCollection) :: tables
 TYPE (Table) :: tab, tab2
 REAL (KIND = float) :: out
 REAL (KIND = double) :: dOut
 INTEGER :: i

 !initialize a new table reading from the file passed as an argument.
 !At the end of initialization, file is closed.
 CALL TableNew ( 'table.txt', tab )

 !initialize a new table reading from a file already open. 
 !Unit of the file is passed as an argument.
 !At the end of initialization, file is not closed.
 OPEN (unit=10, file='table2.txt')
 CALL TableNew ( 10, tab2 ) .

 !initialize a collection of tables reading from a file whose name 
 !is specified as argument.
 CALL TableNew ( 'tables.txt', tables )

 !extract value from table with different methods.
 !input value must be a float number. Output can be long integer, 
 !float real or double real.

 !get float that corresponds exactly to input float. Bound is not 
 !necessary (it does not make sense).
 !If input value is not found, an error message is logged.
 CALL TableGetValue ( 302., tab, 'stage', 'discharge', 'exact', out)
 WRITE(*,*) 'The discharge corresponding to selected case is: ', out

 !get float calculating a linear interpolation between the two nearest values. 
 !Option bound = 'fixed' limits the search inside the extreme values 
 !of the table. If extreme values are exceeded, an error is thrown.
 CALL TableGetValue ( 302.4, tab, 'stage', 'discharge', 'linear', out, &
                      bound = 'fixed' )
 WRITE(*,*) 'The discharge corresponding to input value is: ', out

 !get float calculating a linear interpolation between the two nearest values. 
 !Option bound = 'extendlinear' means that if the input value is outside 
 !extreme values of the table, they are linearly extended  using the 
 !last two elements of the table. A warning message is logged.
 CALL TableGetValue ( 304., tab, 'stage', 'discharge', 'linear', out, &
                      bound = 'extendlinear' )
 WRITE(*,*) 'The discharge corresponding to input value is: ', out

 !get float calculating a linear interpolation between the two nearest values. 
 !Option bound = 'extendconstant' means that if the input value is 
 !outside extreme values of the table, the last element is extended 
 !as a constant. A warning message is logged.
 CALL TableGetValue ( 304., tab, 'stage', 'discharge', 'linear', out, &
                      bound = 'extendconstant' )
 WRITE(*,*) 'The discharge corresponding to input value is: ', out

 !get float searching for the nearest value.
 CALL TableGetValue ( 302.55, tab, 'stage', 'discharge', 'nearest', out)
 WRITE(*,*) 'The discharge nearest to input value is: ', out

 !get double calculating a linear interpolation between the two nearest values. 
 !Option bound = 'fixed' limits the search inside the extreme values of the 
 !table. If extreme values are exceeded, an error is thrown.
 CALL TableGetValue ( 302.4, tab, 'stage', 'discharge', 'linear', dOut, &
                      bound = 'fixed' )
 WRITE(*,*) 'The discharge corresponding to input value is: ', dOut

 !get float calculating a linear interpolation between the two nearest values. 
 !Option bound = 'fixed' limits the search inside the extreme values of 
 !the table. If extreme values are exceeded, an error is thrown.
 CALL TableGetValue ( 302.4, tables, 'tab02', 'stage', 'discharge', 'linear', &
                      out, bound = 'fixed' )
 WRITE(*,*) 'The discharge corresponding to input value is: ', out

 !get double calculating a linear interpolation between the two nearest values.
 ! Option bound = 'fixed' limits the search inside the extreme values of the table. 
 !If extreme values are exceeded, an error is thrown.
 CALL TableGetValue ( 302.4, tables, 'tab02', 'stage', 'discharge', 'linear', &
                      dOut, bound = 'fixed' )
 WRITE(*,*) 'The discharge corresponding to input value is: ', dOut

 !export table on file. Name of the file is passed as argument
 CALL TableExport ( tab, 'fileout.txt' )

 !export table on a file taht is already open. Unit of file is passed as argument
 OPEN (UNIT = 20, file = 'exported_table.txt')
 CALL TableExport ( tab, 20 )
 CLOSE (20)

 !export a collection of tables on a file. Name of the file is passed as argument
 CALL TableExport ( tables, 'table_collections.txt' )

 !export just one table from a collection of tables on a filetaht is already open. 
 !Unit of file is passed as argument
 OPEN (UNIT = 20, file = 'tab02.txt')
 CALL TableExport ( tables, 20, 'tab02' )
 CLOSE (20)

END PROGRAM TestTableLib

References and Credits: ODT data table format http://math.nist.gov/oommf/doc/userguide11b2/userguide/Data_table_format_ODT.html

Known issues: when processing table with lots of rows, stack overflow may occur. Decrease LINELENGTH parameter or increase stack size before compiling.



Contents


Variables

Type Visibility Attributes Name Initial
integer(kind=long), private, parameter :: LINELENGTH = 1000

Interfaces

public interface TableExport

  • private subroutine TableWriteToFile(tab, file)

    write a table on file. Arguments: tab table to export file file to whom write the table

    Arguments

    Type IntentOptional Attributes Name
    type(Table), intent(in) :: tab
    character(len=*), intent(in) :: file
  • private subroutine TableWriteToUnit(tab, iunit)

    write a table on file taht is already open. Arguments: tab table to export iunit unit of file to whom write the table

    Arguments

    Type IntentOptional Attributes Name
    type(Table), intent(in) :: tab
    integer(kind=short), intent(in) :: iunit
  • private subroutine TablesWriteToFile(tables, file, id)

    write a collection of tables on file. If id is present, only the table corresponding to that id is written. Arguments: tables collection of tables to be exported file file to whom write the table

    Arguments

    Type IntentOptional Attributes Name
    type(TableCollection), intent(in) :: tables
    character(len=*), intent(in) :: file
    character(len=*), intent(in), optional :: id
  • private subroutine TablesWriteToUnit(tables, iunit, id)

    write a collection of tables on file already open. If id is present, only the table corresponding to that id is written. Arguments: tables collection of tables to be exported iunit unit to whom write the table

    Arguments

    Type IntentOptional Attributes Name
    type(TableCollection), intent(in) :: tables
    integer(kind=short), intent(in) :: iunit
    character(len=*), intent(in), optional :: id

public interface TableGetNrows

  • private function TableGetNumberRows(tab) result(rows)

    return the number of rows in a table

    Arguments

    Type IntentOptional Attributes Name
    type(Table), intent(in) :: tab

    Return Value integer

  • public function TablesGetNumberRows(tables, id) result(rows)

    return the number of rows of a table in a table collection

    Arguments

    Type IntentOptional Attributes Name
    type(TableCollection), intent(in) :: tables
    character(len=*), intent(in) :: id

    Return Value integer

public interface TableGetValue

  • private subroutine TableGetFloat(valueIn, tab, keyIn, keyOut, match, valueOut, bound)

    returns a float from column defined by keyOut corresponding to valueIn contained in column defined by keyIn. Arguments: valueIn input value tab table to search in keyIn defines header of the column of the input value keyOut defines header of the column of the output value match method to match input value. Possible values are: 'exact' = column must contain exact input value 'linear' = calculates linear interpolation between two bounding values 'nearest' = search for the nearest value in input column bound method to manage bounds. Possible values are: 'fixed' = extreme values are treated as a wall 'extendlinear' = extend bounds with linear interpolation of last two extreme values 'extendconstant' = extend bounds preserving extreme value constant

    Arguments

    Type IntentOptional Attributes Name
    real(kind=float), intent(in) :: valueIn
    type(Table), intent(in) :: tab
    character(len=*), intent(in) :: keyIn
    character(len=*), intent(in) :: keyOut
    character(len=*), intent(in) :: match
    real(kind=float), intent(out) :: valueOut
    character(len=*), intent(in), optional :: bound
  • private subroutine TableGetDouble(valueIn, tab, keyIn, keyOut, match, valueOut, bound)

    returns a double from column defined by keyOut corresponding to valueIn contained in column defined by keyIn. Arguments: valueIn input value tab table to search in keyIn defines header of the column of the input value keyOut defines header of the column of the output value match method to match input value. Possible values are: 'exact' = column must contain exact input value 'linear' = calculates linear interpolation between two bounding values 'nearest' = search for the nearest value in input column bound method to manage bounds. Possible values are: 'fixed' = extreme values are treated as a wall 'extendlinear' = extend bounds with linear interpolation of last two extreme values 'extendconstant' = extend bounds preserving extreme value constant

    Arguments

    Type IntentOptional Attributes Name
    real(kind=float), intent(in) :: valueIn
    type(Table), intent(in) :: tab
    character(len=*), intent(in) :: keyIn
    character(len=*), intent(in) :: keyOut
    character(len=*), intent(in) :: match
    real(kind=double), intent(out) :: valueOut
    character(len=*), intent(in), optional :: bound
  • private subroutine TableGetString(valueIn, tab, keyIn, keyOut, valueOut)

    returns a string from column defined by keyOut corresponding to valueIn contained in column defined by keyIn. Arguments: valueIn input value tab table to search in keyIn defines header of the column of the input value keyOut defines header of the column of the output value

    Arguments

    Type IntentOptional Attributes Name
    real(kind=float), intent(in) :: valueIn
    type(Table), intent(in) :: tab
    character(len=*), intent(in) :: keyIn
    character(len=*), intent(in) :: keyOut
    character(len=*), intent(out) :: valueOut
  • private subroutine TablesGetFloat(valueIn, tables, id, keyIn, keyOut, match, valueOut, bound)

    returns a float from column defined by keyOut corresponding to valueIn contained in column defined by keyIn. Table is identified by its id. Arguments: valueIn input value tables collection of tables to search in id id of the table to search in keyIn defines header of the column of the input value keyOut defines header of the column of the output value match method to match input value. Possible values are: 'exact' = column must contain exact input value 'linear' = calculates linear interpolation between two bounding values 'nearest' = search for the nearest value in input column bound method to manage bounds. Possible values are: 'fixed' = extreme values are treated as a wall 'extendlinear' = extend bounds with linear interpolation of last two extreme values 'extendconstant' = extend bounds preserving extreme value constant

    Arguments

    Type IntentOptional Attributes Name
    real(kind=float), intent(in) :: valueIn
    type(TableCollection), intent(in) :: tables
    character(len=*), intent(in) :: id
    character(len=*), intent(in) :: keyIn
    character(len=*), intent(in) :: keyOut
    character(len=*), intent(in) :: match
    real(kind=float), intent(out) :: valueOut
    character(len=*), intent(in), optional :: bound
  • private subroutine TablesGetDouble(valueIn, tables, id, keyIn, keyOut, match, valueOut, bound)

    returns a double from column defined by keyOut corresponding to valueIn contained in column defined by keyIn. Table is identified by its id. Arguments: valueIn input value tables collection of tables to search in id id of the table to search in keyIn defines header of the column of the input value keyOut defines header of the column of the output value match method to match input value. Possible values are: 'exact' = column must contain exact input value 'linear' = calculates linear interpolation between two bounding values 'nearest' = search for the nearest value in input column bound method to manage bounds. Possible values are: 'fixed' = extreme values are treated as a wall 'extendlinear' = extend bounds with linear interpolation of last two extreme values 'extendconstant' = extend bounds preserving extreme value constant

    Arguments

    Type IntentOptional Attributes Name
    real(kind=float), intent(in) :: valueIn
    type(TableCollection), intent(in) :: tables
    character(len=*), intent(in) :: id
    character(len=*), intent(in) :: keyIn
    character(len=*), intent(in) :: keyOut
    character(len=*), intent(in) :: match
    real(kind=double), intent(out) :: valueOut
    character(len=*), intent(in), optional :: bound
  • private subroutine TablesGetString(valueIn, tables, id, keyIn, keyOut, valueOut)

    returns a string from column defined by keyOut corresponding to valueIn contained in column defined by keyIn. Table is identified by its id. Arguments: valueIn input value tables collection of tables to search in id id of the table to search in keyIn defines header of the column of the input value keyOut defines header of the column of the output value

    Arguments

    Type IntentOptional Attributes Name
    real(kind=float), intent(in) :: valueIn
    type(TableCollection), intent(in) :: tables
    character(len=*), intent(in) :: id
    character(len=*), intent(in) :: keyIn
    character(len=*), intent(in) :: keyOut
    character(len=*), intent(out) :: valueOut

public interface TableNew

  • private subroutine TablesGetFromFile(file, tables)

    read a collection of tables from specified file. Arguments: file file in which table is contained tables returned collection of tables

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: file
    type(TableCollection), intent(out) :: tables
  • private subroutine TablesGetFromUnit(unit, tables)

    read a collection of tables from specified unit. File is already open. Arguments: unit unit of file in which table is contained tables returned collection of tables

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=short), intent(in) :: unit
    type(TableCollection), intent(out) :: tables
  • private subroutine TableGetFromFile(file, tab, id)

    read a table from specified file. File is not yet open. If id is not specified, in a file containing multiple tables, the first table is read Arguments: file file in which table is contained tab returned table id optional, id of table to read

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: file
    type(Table), intent(out) :: tab
    character(len=*), intent(in), optional :: id
  • private subroutine TableGetFromUnit(unit, tab, id)

    read a table from specified file unit. File is already open. Arguments: unit file in which table is contained tab returned table id optional, id of table to read

    Arguments

    Type IntentOptional Attributes Name
    integer(kind=short), intent(in) :: unit
    type(Table), intent(out) :: tab
    character(len=*), intent(in), optional :: id

Derived Types

type, public ::  Table

Components

Type Visibility Attributes Name Initial
type(Column), public, POINTER :: col(:)
character(len=30), public :: id

Max length of id: 30 characters

integer(kind=long), public :: noCols

number of columns

integer(kind=long), public :: noRows

number of rows

character(len=300), public :: title

Max length of title: 300 characters

type, public ::  TableCollection

Components

Type Visibility Attributes Name Initial
type(Table), public, POINTER :: elem(:)
integer(kind=long), public :: number

type, private ::  Column

Components

Type Visibility Attributes Name Initial
character(len=100), public :: header
character(len=100), public, POINTER :: row(:)
character(len=100), public :: unit

Functions

public function TablesGetIds(tables) result(ids)

Return a list of Ids from TableCollection Arguments: tables collections of tbles Result: Return Ids

Arguments

Type IntentOptional Attributes Name
type(TableCollection), intent(in) :: tables

Return Value character(len=30), ALLOCATABLE, (:)

public function TablesGetNumberRows(tables, id) result(rows)

return the number of rows of a table in a table collection

Arguments

Type IntentOptional Attributes Name
type(TableCollection), intent(in) :: tables
character(len=*), intent(in) :: id

Return Value integer

private function TableCountCols(lines) result(cols)

Count the number of columns in a table stored in a collection of lines. Method: count the number of tokens included in parentheses []. Arguments: lines collections of lines Result: Return number of columns

Arguments

Type IntentOptional Attributes Name
character(len=LINELENGTH), intent(in), POINTER :: lines(:)

Return Value integer(kind=short)

private function TableCountRows(lines) result(rows)

Count the number of rowss in a table stored in a collection of lines. Method: count the number of non blank lines that have not a keyword. Arguments: lines collections of lines Result: Return number of rows

Arguments

Type IntentOptional Attributes Name
character(len=LINELENGTH), intent(in), POINTER :: lines(:)

Return Value integer(kind=short)

private function TableFileSync(unit, id, line) result(code)

search the file for beginning of next table defined by keyword Table Start Arguments: unit file in which operate search id optional, table id line optional, line of file to begin search Result: Return -1 when table is not found line of beginning of a table

Arguments

Type IntentOptional Attributes Name
integer(kind=short), intent(in) :: unit
character(len=*), intent(in), optional :: id
integer(kind=long), intent(inout), optional :: line

Return Value integer(kind=short)

private function TableGetNumberRows(tab) result(rows)

return the number of rows in a table

Arguments

Type IntentOptional Attributes Name
type(Table), intent(in) :: tab

Return Value integer

private function TableReadId(lines) result(id)

Read the Id of the table. Id is mandatory and must be unique. Arguments: lines collections of lines Result: Return Id

Arguments

Type IntentOptional Attributes Name
character(len=LINELENGTH), intent(in), POINTER :: lines(:)

Return Value character(len=300)

private function TableReadTitle(lines) result(title)

Read the title of the table. Title is optional. Arguments: lines collections of lines Result: Return title if exists

Arguments

Type IntentOptional Attributes Name
character(len=LINELENGTH), intent(in), POINTER :: lines(:)

Return Value character(len=300)

private function TableSyncById(tables, id) result(pos)

returns the position of table in collection of tables identified by id. Arguments: tables collection of tables to search in id id of the table

Arguments

Type IntentOptional Attributes Name
type(TableCollection), intent(in) :: tables
character(len=*), intent(in) :: id

Return Value integer(kind=long)


Subroutines

private subroutine CheckId(tables, pos)

Arguments

Type IntentOptional Attributes Name
type(TableCollection), intent(in) :: tables
integer(kind=long), intent(in) :: pos

private subroutine TableGetDouble(valueIn, tab, keyIn, keyOut, match, valueOut, bound)

returns a double from column defined by keyOut corresponding to valueIn contained in column defined by keyIn. Arguments: valueIn input value tab table to search in keyIn defines header of the column of the input value keyOut defines header of the column of the output value match method to match input value. Possible values are: 'exact' = column must contain exact input value 'linear' = calculates linear interpolation between two bounding values 'nearest' = search for the nearest value in input column bound method to manage bounds. Possible values are: 'fixed' = extreme values are treated as a wall 'extendlinear' = extend bounds with linear interpolation of last two extreme values 'extendconstant' = extend bounds preserving extreme value constant

Arguments

Type IntentOptional Attributes Name
real(kind=float), intent(in) :: valueIn
type(Table), intent(in) :: tab
character(len=*), intent(in) :: keyIn
character(len=*), intent(in) :: keyOut
character(len=*), intent(in) :: match
real(kind=double), intent(out) :: valueOut
character(len=*), intent(in), optional :: bound

private subroutine TableGetFloat(valueIn, tab, keyIn, keyOut, match, valueOut, bound)

returns a float from column defined by keyOut corresponding to valueIn contained in column defined by keyIn. Arguments: valueIn input value tab table to search in keyIn defines header of the column of the input value keyOut defines header of the column of the output value match method to match input value. Possible values are: 'exact' = column must contain exact input value 'linear' = calculates linear interpolation between two bounding values 'nearest' = search for the nearest value in input column bound method to manage bounds. Possible values are: 'fixed' = extreme values are treated as a wall 'extendlinear' = extend bounds with linear interpolation of last two extreme values 'extendconstant' = extend bounds preserving extreme value constant

Arguments

Type IntentOptional Attributes Name
real(kind=float), intent(in) :: valueIn
type(Table), intent(in) :: tab
character(len=*), intent(in) :: keyIn
character(len=*), intent(in) :: keyOut
character(len=*), intent(in) :: match
real(kind=float), intent(out) :: valueOut
character(len=*), intent(in), optional :: bound

private subroutine TableGetFromFile(file, tab, id)

read a table from specified file. File is not yet open. If id is not specified, in a file containing multiple tables, the first table is read Arguments: file file in which table is contained tab returned table id optional, id of table to read

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: file
type(Table), intent(out) :: tab
character(len=*), intent(in), optional :: id

private subroutine TableGetFromUnit(unit, tab, id)

read a table from specified file unit. File is already open. Arguments: unit file in which table is contained tab returned table id optional, id of table to read

Arguments

Type IntentOptional Attributes Name
integer(kind=short), intent(in) :: unit
type(Table), intent(out) :: tab
character(len=*), intent(in), optional :: id

private subroutine TableGetString(valueIn, tab, keyIn, keyOut, valueOut)

returns a string from column defined by keyOut corresponding to valueIn contained in column defined by keyIn. Arguments: valueIn input value tab table to search in keyIn defines header of the column of the input value keyOut defines header of the column of the output value

Arguments

Type IntentOptional Attributes Name
real(kind=float), intent(in) :: valueIn
type(Table), intent(in) :: tab
character(len=*), intent(in) :: keyIn
character(len=*), intent(in) :: keyOut
character(len=*), intent(out) :: valueOut

private subroutine TableReadContent(lines, tab)

read the content of the table. Arguments: lines collection of strings that contain table information tab table to update

Arguments

Type IntentOptional Attributes Name
character(len=LINELENGTH), intent(in), POINTER :: lines(:)
type(Table), intent(out) :: tab

private subroutine TableReadHeader(lines, tab)

read header of the columns of the table. Arguments: lines collection of strings that contain table information tab table to update

Arguments

Type IntentOptional Attributes Name
character(len=LINELENGTH), intent(in), POINTER :: lines(:)
type(Table), intent(out) :: tab

private subroutine TableReadUnit(lines, tab)

read unit of the columns of the table. Arguments: lines collection of strings that contain table information tab table to update

Arguments

Type IntentOptional Attributes Name
character(len=LINELENGTH), intent(in), POINTER :: lines(:)
type(Table), intent(out) :: tab

private subroutine TableStoreLines(unit, lines)

read the lines of a table which are stored in an array of strings. Non significative lines (i.e. comments or blank lines) are ignored. Subroutine supposes that the cursor is sync to the first line after the keyword 'Table Start'. hence it is must benn called after a call to tableFileSync. Arguments: unit file in which table is contained lines returned collection of linestable

Arguments

Type IntentOptional Attributes Name
integer(kind=short), intent(in) :: unit
character(len=LINELENGTH), intent(out), POINTER :: lines(:)

private subroutine TableWriteToFile(tab, file)

write a table on file. Arguments: tab table to export file file to whom write the table

Arguments

Type IntentOptional Attributes Name
type(Table), intent(in) :: tab
character(len=*), intent(in) :: file

private subroutine TableWriteToUnit(tab, iunit)

write a table on file taht is already open. Arguments: tab table to export iunit unit of file to whom write the table

Arguments

Type IntentOptional Attributes Name
type(Table), intent(in) :: tab
integer(kind=short), intent(in) :: iunit

private subroutine TablesGetDouble(valueIn, tables, id, keyIn, keyOut, match, valueOut, bound)

returns a double from column defined by keyOut corresponding to valueIn contained in column defined by keyIn. Table is identified by its id. Arguments: valueIn input value tables collection of tables to search in id id of the table to search in keyIn defines header of the column of the input value keyOut defines header of the column of the output value match method to match input value. Possible values are: 'exact' = column must contain exact input value 'linear' = calculates linear interpolation between two bounding values 'nearest' = search for the nearest value in input column bound method to manage bounds. Possible values are: 'fixed' = extreme values are treated as a wall 'extendlinear' = extend bounds with linear interpolation of last two extreme values 'extendconstant' = extend bounds preserving extreme value constant

Arguments

Type IntentOptional Attributes Name
real(kind=float), intent(in) :: valueIn
type(TableCollection), intent(in) :: tables
character(len=*), intent(in) :: id
character(len=*), intent(in) :: keyIn
character(len=*), intent(in) :: keyOut
character(len=*), intent(in) :: match
real(kind=double), intent(out) :: valueOut
character(len=*), intent(in), optional :: bound

private subroutine TablesGetFloat(valueIn, tables, id, keyIn, keyOut, match, valueOut, bound)

returns a float from column defined by keyOut corresponding to valueIn contained in column defined by keyIn. Table is identified by its id. Arguments: valueIn input value tables collection of tables to search in id id of the table to search in keyIn defines header of the column of the input value keyOut defines header of the column of the output value match method to match input value. Possible values are: 'exact' = column must contain exact input value 'linear' = calculates linear interpolation between two bounding values 'nearest' = search for the nearest value in input column bound method to manage bounds. Possible values are: 'fixed' = extreme values are treated as a wall 'extendlinear' = extend bounds with linear interpolation of last two extreme values 'extendconstant' = extend bounds preserving extreme value constant

Arguments

Type IntentOptional Attributes Name
real(kind=float), intent(in) :: valueIn
type(TableCollection), intent(in) :: tables
character(len=*), intent(in) :: id
character(len=*), intent(in) :: keyIn
character(len=*), intent(in) :: keyOut
character(len=*), intent(in) :: match
real(kind=float), intent(out) :: valueOut
character(len=*), intent(in), optional :: bound

private subroutine TablesGetFromFile(file, tables)

read a collection of tables from specified file. Arguments: file file in which table is contained tables returned collection of tables

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: file
type(TableCollection), intent(out) :: tables

private subroutine TablesGetFromUnit(unit, tables)

read a collection of tables from specified unit. File is already open. Arguments: unit unit of file in which table is contained tables returned collection of tables

Arguments

Type IntentOptional Attributes Name
integer(kind=short), intent(in) :: unit
type(TableCollection), intent(out) :: tables

private subroutine TablesGetString(valueIn, tables, id, keyIn, keyOut, valueOut)

returns a string from column defined by keyOut corresponding to valueIn contained in column defined by keyIn. Table is identified by its id. Arguments: valueIn input value tables collection of tables to search in id id of the table to search in keyIn defines header of the column of the input value keyOut defines header of the column of the output value

Arguments

Type IntentOptional Attributes Name
real(kind=float), intent(in) :: valueIn
type(TableCollection), intent(in) :: tables
character(len=*), intent(in) :: id
character(len=*), intent(in) :: keyIn
character(len=*), intent(in) :: keyOut
character(len=*), intent(out) :: valueOut

private subroutine TablesWriteToFile(tables, file, id)

write a collection of tables on file. If id is present, only the table corresponding to that id is written. Arguments: tables collection of tables to be exported file file to whom write the table

Arguments

Type IntentOptional Attributes Name
type(TableCollection), intent(in) :: tables
character(len=*), intent(in) :: file
character(len=*), intent(in), optional :: id

private subroutine TablesWriteToUnit(tables, iunit, id)

write a collection of tables on file already open. If id is present, only the table corresponding to that id is written. Arguments: tables collection of tables to be exported iunit unit to whom write the table

Arguments

Type IntentOptional Attributes Name
type(TableCollection), intent(in) :: tables
integer(kind=short), intent(in) :: iunit
character(len=*), intent(in), optional :: id