obsdbFiles_mod¶
Dependency Diagrams:
Description
MODULE obsdbFiles_mod (prefix=’odbf’ category=’3. Observation input/output’)
- Purpose
To read and update sqlite files that are in the new ‘obsDB’ format.
Quick access
- Routines
getcreatetableinsertqueries()
,mergetableinmidastables()
,obdf_clean()
,odbf_adjustvalues()
,odbf_copytoobsspacebody()
,odbf_copytoobsspacehead()
,odbf_copytoobsspaceheadchar()
,odbf_copytoobsspaceheaddate()
,odbf_createmidasbodytable()
,odbf_createmidasheadertable()
,odbf_getdatestamp()
,odbf_getprimarykeys()
,odbf_insertinmidasbodytable()
,odbf_insertinmidasheadertable()
,odbf_midastabcolfromobsspacename()
,odbf_readfile()
,odbf_readmidasbodytable()
,odbf_setsurfacetype()
,odbf_setup()
,odbf_sqlnamefromobsspacename()
,odbf_updatefile()
,odbf_varnofromsqlname()
Needed modules
midasmpi_mod
: MODULE midasMpi_mod (prefix=’mmpi’ category=’8. Low-level utilities and constants’)
codeprecision_mod
: MODULE codePrecision_mod (prefix=’pre’ category=’8. Low-level utilities and constants’)
mathphysconstants_mod
: MODULE mathPhysConstants_mod (prefix=’mpc’ category=’8. Low-level utilities and constants’)
bufr_mod
: MODULE bufr_mod (prefix=’bufr’ category=’8. Low-level utilities and constants’)
codtyp_mod
: MODULE codtyp_mod (prefix=’codtyp’ category=’8. Low-level utilities and constants’)
obsspacedata_mod
: MODULE obsSpaceData_mod (prefix=’obs’ category=’6. High-level data objects’)
fsqlite
utilities_mod
: MODULE utilities_mod (prefix=’utl’ category=’8. Low-level utilities and constants’)
clibinterfaces_mod
: MODULE clibInterfaces_mod (prefix=’’ category=’9. Global interfaces’)
obsutil_mod
: MODULE obsUtil_mod (prefix=’obsu’ category=’3. Observation input/output’)
obsvariabletransforms_mod
: MODULE obsVariableTransforms_mod (prefix=’ovt’ category=’4. Data Object transformations’)
sqliteutilities_mod
: MODULE sqliteUtilities_mod (prefix=’sqlu’ category=’3. Observation input/output’)
timecoord_mod
: MODULE timeCoord_mod (prefix=’tim’ category=’7. Low-level data objects’)Variables
Subroutines and functions
- subroutine obsdbfiles_mod/readnml()¶
- Purpose
Read the namelist for obsDB files
- Call to
- subroutine obsdbfiles_mod/odbf_setup()¶
- Purpose
Read the namelist for obsDB files and read the obsDB column table
- Called from
- Call to
- subroutine obsdbfiles_mod/odbf_getdatestamp(datestamp, filename)¶
Purpose: get dateStamp from an obsDB file
- Arguments
datestamp [integer ,out]
filename [character ,in]
- Called from
- Call to
odbf_setup()
,sqlu_getcolumnvaluesdatestr()
,tim_getvaliddatetimefromlist()
,utl_abort()
- subroutine obsdbfiles_mod/odbf_readfile(obsdat, filename, familytype, fileindex)¶
- Purpose
Read the contents of an obsDB file and put in obsSpaceData
- Arguments
obsdat [struct_obs ,inout]
filename [character ,in]
familytype [character ,in]
fileindex [integer ,in]
- Called from
- Call to
odbf_setup()
,ovt_setup()
,sqlu_getsqlcolumnnames()
,odbf_getprimarykeys()
,sqlu_getcolumnvaluesdatestr()
,sqlu_getcolumnvalueschar()
,sqlu_getcolumnvaluesnum()
,obs_numbody()
,obs_numheader()
,obs_headset_i()
,odbf_setsurfacetype()
,odbf_copytoobsspaceheaddate()
,odbf_copytoobsspaceheadchar()
,odbf_copytoobsspacehead()
,odbf_copytoobsspacebody()
,obs_setfamily()
,obs_headelem_i()
,odbf_readmidasbodytable()
,odbf_adjustvalues()
,ovt_transformobsvalues()
,ovt_adjusthumgz()
,obsu_computevertcoordsurfobs()
,obsu_setgbgpserror()
- subroutine obsdbfiles_mod/odbf_readmidasbodytable(obsdat, filename, familytype, fileindex)¶
- Purpose
Read values from any column found the MIDAS table, if it already exists in the file. This will replace any existing values read from the original obs-DB tables (e.g. the obs value).
- Arguments
obsdat [struct_obs ,inout]
filename [character ,in]
familytype [character ,in]
fileindex [integer ,in]
- Called from
- Call to
sqlu_sqltableexists()
,odbf_midastabcolfromobsspacename()
,sqlu_sqlcolumnexists()
,utl_abort()
,obs_columnindexfromname()
,obs_columndatatype()
,obs_columnactive_rb()
,obs_columnactive_ib()
,obs_numheader()
,obs_headelem_i()
,obs_bodyprimarykey()
,obs_bodyelem_i()
,obs_bodyelem_r()
,obs_bodyset_i()
- subroutine obsdbfiles_mod/odbf_getprimarykeys(headprimarykey, bodyprimarykey, bodyheadkey, filename)¶
- Purpose
Read the values from obsDB file for the head and body table primary keys.
- Arguments
headprimarykey (*) [integer ,out,allocatable]
bodyprimarykey (*) [integer ,out,allocatable]
bodyheadkey (*) [integer ,out,allocatable]
filename [character ,in]
- Called from
- Call to
- subroutine obsdbfiles_mod/odbf_setsurfacetype(obsdat, headindexbegin, numrowsheadtable, filename, tablename)¶
- Purpose
Set the surface type based on lat-lon and some external mask files.
- Arguments
obsdat [struct_obs ,inout]
headindexbegin [integer ,in]
numrowsheadtable [integer ,in]
filename [character ,in]
tablename [character ,in]
- Called from
- Call to
- subroutine obsdbfiles_mod/odbf_copytoobsspaceheadchar(obsdat, headcharsqlnames, headcharvalues, headindexbegin)¶
- Purpose
Copy character string values from a local table into obsSpaceData header rows. Currently, only the STATION ID and OBS_ITY (i.e. codeType from character sql column containing obs type name).
- Arguments
obsdat [struct_obs ,inout]
headcharsqlnames (*) [character ,in]
headcharvalues (*,*) [character ,in]
headindexbegin [integer ,in]
- Called from
- Call to
odbf_sqlnamefromobsspacename()
,utl_abort()
,obs_set_c()
,codtyp_get_codtyp()
,obs_headset_i()
- subroutine obsdbfiles_mod/odbf_copytoobsspaceheaddate(obsdat, headdatevalues, headtimevalues, headindexbegin)¶
- Purpose
Copy date values from a local table into obsSpaceData header rows.
- Arguments
obsdat [struct_obs ,inout]
headdatevalues (*) [integer ,in]
headtimevalues (*) [integer ,in]
headindexbegin [integer ,in]
- Called from
- Call to
- subroutine obsdbfiles_mod/odbf_copytoobsspacehead(obsdat, headsqlnames, headprimarykey, headvalues, headindexbegin)¶
- Purpose
Copy real and integer values from a local table into obsSpaceData header rows.
- Arguments
obsdat [struct_obs ,inout]
headsqlnames (*) [character ,in]
headprimarykey (*) [integer ,in]
headvalues (*,*) [real ,in]
headindexbegin [integer ,in]
- Called from
- Call to
obs_setheadprimarykey()
,obs_columnindexfromname()
,obs_columndatatype()
,obs_columnactive_rh()
,obs_columnactive_ih()
,obs_headset_i()
,utl_abort()
- subroutine obsdbfiles_mod/odbf_copytoobsspacebody(obsdat, bodysqlnames, bodyprimarykey, bodyheadkey, bodyvalues, bodyindexbegin, headindexbegin)¶
- Purpose
Copy real and integer values from a local table into obsSpaceData body rows. Note: this version currently assumes that only 1 observed quantity is present for each row of the sqlite table. This is likely only valid for radiance observation types and therefore modifications will be required for other observation types.
- Arguments
obsdat [struct_obs ,inout]
bodysqlnames (*) [character ,in]
bodyprimarykey (*) [integer ,in]
bodyheadkey (*) [integer ,in]
bodyvalues (*,*) [real ,in]
bodyindexbegin [integer ,in]
headindexbegin [integer ,in]
- Called from
- Call to
obs_columnindexfromname()
,odbf_sqlnamefromobsspacename()
,utl_abort()
,odbf_varnofromsqlname()
,obs_headset_i()
,obs_headprimarykey()
,obs_headelem_i()
,obs_setbodyprimarykey()
,obs_columnactive_rb()
,obs_bodyset_i()
,obs_columndatatype()
,obs_columnactive_ib()
- subroutine obsdbfiles_mod/odbf_adjustvalues(obsdat, headindexbegin, headindexend)¶
- Purpose
Adjust units and other minor modifications of some obsSpaceData columns after transfer from sqlite files
- Arguments
obsdat [struct_obs ,inout]
headindexbegin [integer ,in]
headindexend [integer ,in]
- Called from
- Call to
obs_getfamily()
,obs_headelem_i()
,obs_headelem_r()
,obs_headset_i()
,obs_bodyset_i()
,codtyp_get_codtyp()
,obsu_cvt_obs_instrum()
,obs_columnactive_rb()
,obs_bodyelem_r()
- function obsdbfiles_mod/odbf_sqlnamefromobsspacename(obsspacename)¶
- Purpose
Return the corresponding sql file column name for a given obsSpaceData column name from the matching tables.
- Arguments
obsspacename [character ,in]
- Return
sqlname (*) [character ,allocatable]
- Called from
- Call to
- function obsdbfiles_mod/odbf_midastabcolfromobsspacename(obsspacename, midassqlcolumnlist)¶
- Purpose
Return the corresponding sql file column name for a given obsSpaceData column name from the midas table matching list.
- Arguments
obsspacename [character ,in]
midassqlcolumnlist (*,*) [character ,in]
- Return
sqlcolname [character ]
- Called from
odbf_readmidasbodytable()
,obdf_clean()
,getcreatetableinsertqueries()
- Call to
- function obsdbfiles_mod/odbf_varnofromsqlname(sqlname)¶
- Purpose
Return the bufr element id number from the corresponding sql file column name of an observed value.
- Arguments
sqlname [character ,in]
- Return
varno [integer ]
- Called from
- Call to
- subroutine obsdbfiles_mod/odbf_updatefile(obsdat, filename, familytype, fileindex)¶
- Purpose
Call subroutines to update MIDAS Header and Body tables
- Arguments
obsdat [struct_obs ,inout]
filename [character ,in]
familytype [character ,in]
fileindex [integer ,in]
- Called from
- Call to
utl_tmg_start()
,odbf_setup()
,utl_isnamelistpresent()
,odbf_insertinmidasheadertable()
,odbf_insertinmidasbodytable()
,utl_tmg_stop()
- subroutine obsdbfiles_mod/odbf_insertinmidasheadertable(obsdat, fileindex, filename, familytype)¶
- Purpose
Insert selected columns in the MIDAS Header Output table using values from obsSpaceData. If the MIDAS Header table does not already exist, it is created by copying the observation table. A single table is created that contains all quantities being updated. Unlike the observation table, each observed variable is stored in a separate row and all quantities are in columns (e.g. ETOP, VTOP, ECF,…).
- Arguments
obsdat [struct_obs ,inout]
fileindex [integer ,in]
filename [character ,in]
familytype [character ,in]
- Called from
- Call to
utl_abort()
,sqlu_sqltableexists()
,odbf_createmidasheadertable()
,obs_numheader()
,obs_headelem_i()
,obs_headprimarykey()
,getcreatetableinsertqueries()
,obs_columndatatype()
,obs_headelem_r()
,mergetableinmidastables()
- subroutine obsdbfiles_mod/odbf_insertinmidasbodytable(obsdat, fileindex, filename, familytype)¶
- Purpose
Insert selected columns in the MIDAS body table using values from obsSpaceData. If the MIDAS Body table does not already exist, it is created by copying the observation table. A single table is created that contains all quantities being updated. Unlike the observation table, each observed variable is stored in a separate row and all quantities are in columns (e.g. obsValue, OMP, OMA,…).
- Arguments
obsdat [struct_obs ,inout]
fileindex [integer ,in]
filename [character ,in]
familytype [character ,in]
- Called from
- Call to
utl_abort()
,sqlu_sqltableexists()
,odbf_createmidasbodytable()
,obs_numheader()
,obs_headelem_i()
,obs_bodyelem_r()
,obs_headprimarykey()
,obs_bodyprimarykey()
,getcreatetableinsertqueries()
,obs_columndatatype()
,obs_bodyelem_i()
,mergetableinmidastables()
- subroutine obsdbfiles_mod/odbf_createmidasheadertable(filename)¶
- Purpose
Create the midasOutput Header table that stores all quantities computed in MIDAS at the level of the obsSpaceData Header table (e.g. ETOP, VTOP, ECF).
- Arguments
filename [character ,in]
- Called from
- Call to
- subroutine obsdbfiles_mod/odbf_createmidasbodytable(filename)¶
- Purpose
Create the midasOutput table that stores all quantities computed in MIDAS at the level of the obsSpaceData Body table (e.g. OMP, OMA, FLG).
- Arguments
filename [character ,in]
- Called from
- Call to
- subroutine obsdbfiles_mod/obdf_clean(filename, familytype)¶
- Arguments
filename [character ,in]
familytype [character ,in]
- Called from
- Call to
utl_isnamelistpresent()
,utl_abort()
,odbf_midastabcolfromobsspacename()
- subroutine obsdbfiles_mod/getcreatetableinsertqueries(numberupdateitems, updateitemlist, midastabletype, querycreatetable, queryinsertintable, tableinsertcolumnlist, obsspacecolindexsourcearr)¶
- Purpose
Generate the queries for creating the table and insert columns into it.
- Arguments
numberupdateitems [integer ,in] :: number of items in update list
updateitemlist (*) [character ,in] :: update list
midastabletype [character ,in] :: table type: ‘header’ or ‘body’
querycreatetable [character ,inout] :: query to create table
queryinsertintable [character ,inout] :: query to insert new columns in the table
tableinsertcolumnlist [character ,inout] :: char of “combinedTableName.column1, combinedTableName.column2, ..”
obsspacecolindexsourcearr (*) [integer ,inout] :: list of obsSpaceData columnIndex for items in update list
- Called from
odbf_insertinmidasheadertable()
,odbf_insertinmidasbodytable()
- Call to
obs_columnindexfromname()
,odbf_midastabcolfromobsspacename()
,obs_columndatatype()
- subroutine obsdbfiles_mod/mergetableinmidastables(filename, midastablename, jointcolumnname, tableinsertcolumnlist)¶
- Purpose
In a series of join/drop/alter merge input table and midasTable to create a new midasTable which contains the original columns plus columns from the input table.
- Arguments
filename [character ,in] :: obsDB filename
midastablename [character ,in] :: name of original midas table to add column to
jointcolumnname [character ,in] :: name of column used to match original midas table and temporary table
tableinsertcolumnlist [character ,in] :: char of “combinedTableName.column1, combinedTableName.column2, ..” to add to original midas table
- Called from
odbf_insertinmidasheadertable()
,odbf_insertinmidasbodytable()
- Call to