• Antelope Release 5.2-64 SunOS 5.10 2012-04-24

 

NAME

cssconvert - convert between css3.0 and css3.1 databases

SYNOPSIS

cssconvert [-use_hardwired_sta_mapping] [-use_expanded_sta_mapping] dbinput dboutput

DESCRIPTION

cssconvert is similar in its action to dbconvert(1). cssconvert will convert an input database in either css3.0 or css3.1 schemas to an output database in either css3.0 or css3.1 schemas. However, there are a number of differences between cssconvert and dbconvert(1). Unlike dbconvert(1), which provides a generalized conversion capability between any two schemas, cssconvert is specific to css3.0 and css3.1 schemas and other schemas that have been derived from these two schemas. Also, unlike dbconvert(1), cssconvert converts the sta database attribute between the input and output databases by first converting the input sta attributes to SEED snet and ssta codes, then converting these SEED codes back to the sta attributes in the output database. The conversions on either side can be independently controlled according to the foreign keys tables and default name mapping rules (see foreign(3) and trdefaults(5)) and to the -use_hardwired_sta_mapping and -use_expanded_sta_mapping command line options described below. Note that the rules for sta name mapping can be different across the input and output databases. Note also that the input and output databases can use the same schema which, along with using different sta name mapping rules, can be used to change the input sta codes to different output sta codes by applying different css to SEED name mapping rules.

The output database must be empty when cssconvert starts or an error message is printed and the program will exit, cssconvert cannot merge to an existing output database. The input and output databases should normally have existing database descriptor files. It is good practise to always use database descriptor files to avoid confusion about the database schemas. Note that an output database can have a descriptor file but still be empty. cssconvert determines the input and output database schema types by first making two temporary databases of schemas css3.0 and css3.1, then querying these two temporary databases to get the sta field size in the wfdisc table, then comparing these field sizes with the sta fields in the input and output databases to determine the schema types. cssconvert makes two passes through the input database. In the first pass, cssconvert is making a number of checks to verify that 1) the two database schemas are either css3.0 or css3.1 or derivatives of these schemas, 2) that each table for both databases contain the same fields, with the exception of the prefmag field in the event table, 3) that no errors are generated in the input and output sta name mappings, 4) that the sta names do not overflow the available field size in the output database, 5) that no other string fields overflow the available field size in the output database. During this initial pass, only the output database snetsta table is created. If any of the verification tests fail, the program will print an error message and exit. It is up to the user to fix the problems in the input database and try again. When rerunning cssconvert after a verification pass failure, it is usually necessary to delete the output snetsta table prior to the rerun. After verification, a second pass is made to write the output tables.

OPTIONS

EXAMPLES



ruper% mkdir test
ruper% cd test
ruper% ls

ruper% head -5 $ANTELOPE/demo/gsn30/dbmaster/gsn.snetsta
II       AAK    AAK     1352315828.93407
II       ABKT   ABKT    1352315829.04746
II       ABPO   ABPO    1352315829.12756
IU       ADK    ADK     1352315829.28377
IU       AFI    AFI     1352315829.46348

ruper% head -5 $ANTELOPE/demo/gsn30/dbmaster/gsn.site | cut -c 1-55
AAK     1990285       -1   42.6390   74.4940    1.6450
ABKT    1993115       -1   37.9304   58.1189    0.6780
ABPO    2007094       -1  -19.0180   47.2290    1.5280
ADK     2009200       -1   51.8823 -176.6842    0.1300
AFI     2010054       -1  -13.9093 -171.7773    0.7060

ruper% cssconvert -use_expanded_sta_mapping $ANTELOPE/demo/gsn30/dbmaster/gsn gsn31
cssconvert: Cannot use expanded sta mapping when output database gsn31 appears to be either css3.0 or a derivative

ruper% ls

ruper% cat > gsn31 << END
? css3.1
? END

ruper% cat gsn31
css3.1

ruper% cssconvert -use_expanded_sta_mapping $ANTELOPE/demo/gsn30/dbmaster/gsn gsn31
checking calibration table
checking instrument table
checking lastid table
checking network table
checking schanloc table
checking sensor table
checking site table
checking sitechan table
checking stage table
processing calibration table
processing instrument table
processing lastid table
processing network table
processing schanloc table
processing sensor table
processing site table
processing sitechan table
processing stage table

ruper% ls
gsn31			gsn31.network		gsn31.sitechan
gsn31.calibration	gsn31.schanloc		gsn31.snetsta
gsn31.instrument	gsn31.sensor		gsn31.stage
gsn31.lastid

ruper% head -5 gsn31.snetsta
II       AAK    II_AAK          1352417311.10125
II       ABKT   II_ABKT         1352417311.12768
II       ABPO   II_ABPO         1352417311.14086
IU       ADK    IU_ADK          1352417311.16664
IU       AFI    IU_AFI          1352417311.19238

ruper% head -5 gsn31.site | cut -c 1-88
II_AAK                    1990285                 -1   42.6390000   74.4940000    1.6450
II_ABKT                   1993115                 -1   37.9304000   58.1189000    0.6780
II_ABPO                   2007094                 -1  -19.0180000   47.2290000    1.5280
IU_ADK                    2009200                 -1   51.8823000 -176.6842000    0.1300
IU_AFI                    2010054                 -1  -13.9093000 -171.7773000    0.7060

ruper% cssconvert gsn31 gsn
checking calibration table
checking instrument table
checking lastid table
checking network table
checking schanloc table
checking sensor table
checking site table
checking sitechan table
checking stage table
processing calibration table
processing instrument table
processing lastid table
processing network table
processing schanloc table
processing sensor table
processing site table
processing sitechan table
processing stage table

ruper% ls
gsn.calibration		gsn.sitechan		gsn31.network
gsn.instrument		gsn.snetsta		gsn31.schanloc
gsn.lastid		gsn.stage		gsn31.sensor
gsn.network		gsn31			gsn31.site
gsn.schanloc		gsn31.calibration	gsn31.sitechan
gsn.sensor		gsn31.instrument	gsn31.snetsta
gsn.site		gsn31.lastid		gsn31.stage

ruper% dbdiff -x ignore gsn $ANTELOPE/demo/gsn30/dbmaster/gsn

ruper%


BUGS AND CAVEATS

cssconvert makes no attempt to convert external files referenced by the input database or modify the dir and dfile fields during the conversion. Because of the way cssconvert converts the sta field from one database to the other, it cannot convert input databases with no snetsta table unless the -use_hardwired_sta_mapping option is specified which will not work if the input database is of schema css3.0 or derived from schema css3.0.

SEE ALSO

dbconvert(1)
foreign(3)

AUTHOR

Danny Harvey
Boulder Real Time Technologies, Inc.
Printer icon