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: 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
Language: Fortran 90.
Software Standards: "European Standards for Writing and
Documenting Exchangeable Fortran 90 Code".
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.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer(kind=long), | private, | parameter | :: | LINELENGTH | = | 1000 |
write a table on file.
Arguments:
tab
table to export
file
file to whom write the table
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Table), | intent(in) | :: | tab | |||
character(len=*), | intent(in) | :: | file |
write a table on file taht is already open.
Arguments:
tab
table to export
iunit
unit of file to whom write the table
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Table), | intent(in) | :: | tab | |||
integer(kind=short), | intent(in) | :: | iunit |
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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(TableCollection), | intent(in) | :: | tables | |||
character(len=*), | intent(in) | :: | file | |||
character(len=*), | intent(in), | optional | :: | 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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(TableCollection), | intent(in) | :: | tables | |||
integer(kind=short), | intent(in) | :: | iunit | |||
character(len=*), | intent(in), | optional | :: | id |
return the number of rows in a table
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Table), | intent(in) | :: | tab |
return the number of rows of a table in a table collection
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(TableCollection), | intent(in) | :: | tables | |||
character(len=*), | intent(in) | :: | id |
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
Type | Intent | Optional | 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 |
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
Type | Intent | Optional | 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 |
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
Type | Intent | Optional | 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 |
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
Type | Intent | Optional | 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 |
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
Type | Intent | Optional | 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 |
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
Type | Intent | Optional | 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 |
read a collection of tables from specified file.
Arguments:
file
file in which table is contained
tables
returned collection of tables
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | file | |||
type(TableCollection), | intent(out) | :: | 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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | unit | |||
type(TableCollection), | intent(out) | :: | tables |
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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | file | |||
type(Table), | intent(out) | :: | tab | |||
character(len=*), | intent(in), | optional | :: | 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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | unit | |||
type(Table), | intent(out) | :: | tab | |||
character(len=*), | intent(in), | optional | :: | id |
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 | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(Table), | public, | POINTER | :: | elem(:) | |||
integer(kind=long), | public | :: | number |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=100), | public | :: | header | ||||
character(len=100), | public, | POINTER | :: | row(:) | |||
character(len=100), | public | :: | unit |
Return a list of Ids from TableCollection
Arguments:
tables
collections of tbles
Result:
Return Ids
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(TableCollection), | intent(in) | :: | tables |
return the number of rows of a table in a table collection
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(TableCollection), | intent(in) | :: | tables | |||
character(len=*), | intent(in) | :: | id |
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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=LINELENGTH), | intent(in), | POINTER | :: | lines(:) |
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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=LINELENGTH), | intent(in), | POINTER | :: | lines(:) |
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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | unit | |||
character(len=*), | intent(in), | optional | :: | id | ||
integer(kind=long), | intent(inout), | optional | :: | line |
return the number of rows in a table
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Table), | intent(in) | :: | tab |
Read the Id of the table. Id is mandatory and must be unique.
Arguments:
lines
collections of lines
Result:
Return Id
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=LINELENGTH), | intent(in), | POINTER | :: | lines(:) |
Read the title of the table. Title is optional.
Arguments:
lines
collections of lines
Result:
Return title if exists
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=LINELENGTH), | intent(in), | POINTER | :: | lines(:) |
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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(TableCollection), | intent(in) | :: | tables | |||
character(len=*), | intent(in) | :: | id |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(TableCollection), | intent(in) | :: | tables | |||
integer(kind=long), | intent(in) | :: | pos |
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
Type | Intent | Optional | 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 |
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
Type | Intent | Optional | 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 |
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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | file | |||
type(Table), | intent(out) | :: | tab | |||
character(len=*), | intent(in), | optional | :: | 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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | unit | |||
type(Table), | intent(out) | :: | tab | |||
character(len=*), | intent(in), | optional | :: | id |
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
Type | Intent | Optional | 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 |
read the content of the table.
Arguments:
lines
collection of strings that contain table information
tab
table to update
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=LINELENGTH), | intent(in), | POINTER | :: | lines(:) | ||
type(Table), | intent(out) | :: | tab |
read header of the columns of the table.
Arguments:
lines
collection of strings that contain table information
tab
table to update
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=LINELENGTH), | intent(in), | POINTER | :: | lines(:) | ||
type(Table), | intent(out) | :: | tab |
read unit of the columns of the table.
Arguments:
lines
collection of strings that contain table information
tab
table to update
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=LINELENGTH), | intent(in), | POINTER | :: | lines(:) | ||
type(Table), | intent(out) | :: | tab |
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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | unit | |||
character(len=LINELENGTH), | intent(out), | POINTER | :: | lines(:) |
write a table on file.
Arguments:
tab
table to export
file
file to whom write the table
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Table), | intent(in) | :: | tab | |||
character(len=*), | intent(in) | :: | file |
write a table on file taht is already open.
Arguments:
tab
table to export
iunit
unit of file to whom write the table
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(Table), | intent(in) | :: | tab | |||
integer(kind=short), | intent(in) | :: | iunit |
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
Type | Intent | Optional | 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 |
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
Type | Intent | Optional | 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 |
read a collection of tables from specified file.
Arguments:
file
file in which table is contained
tables
returned collection of tables
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | file | |||
type(TableCollection), | intent(out) | :: | 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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=short), | intent(in) | :: | unit | |||
type(TableCollection), | intent(out) | :: | tables |
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
Type | Intent | Optional | 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 |
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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(TableCollection), | intent(in) | :: | tables | |||
character(len=*), | intent(in) | :: | file | |||
character(len=*), | intent(in), | optional | :: | 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
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(TableCollection), | intent(in) | :: | tables | |||
integer(kind=short), | intent(in) | :: | iunit | |||
character(len=*), | intent(in), | optional | :: | id |