--
--ER/Studio 7.0 SQL Code Generation
-- Company :      Berkeley Seismological Laboratory
-- Project :      NCEDC/TriNet Application
-- Author :       Stephane Zuzlewski
--
-- Date Created : Thursday, January 12, 2006 09:40:49
-- Target DBMS : Oracle 9i
--

DROP TABLE channelmap_ampparms CASCADE CONSTRAINTS
;
DROP TABLE channelmap_codaparms CASCADE CONSTRAINTS
;
DROP TABLE config_channel CASCADE CONSTRAINTS
;
DROP TABLE gazetteerbigtown CASCADE CONSTRAINTS
;
DROP TABLE gazetteerfault CASCADE CONSTRAINTS
;
DROP TABLE gazetteerline CASCADE CONSTRAINTS
;
DROP TABLE gazetteerpt CASCADE CONSTRAINTS
;
DROP TABLE gazetteerquake CASCADE CONSTRAINTS
;
DROP TABLE gazetteerquarry CASCADE CONSTRAINTS
;
DROP TABLE gazetteertown CASCADE CONSTRAINTS
;
DROP TABLE gazetteertype CASCADE CONSTRAINTS
;
DROP TABLE jasieventlock CASCADE CONSTRAINTS
;
DROP TABLE program CASCADE CONSTRAINTS
;
DROP TABLE request_card CASCADE CONSTRAINTS
;
DROP TABLE rt_role CASCADE CONSTRAINTS
;
DROP TABLE stamapping CASCADE CONSTRAINTS
;
DROP TABLE unassocamp CASCADE CONSTRAINTS
;
-- 
-- TABLE: channelmap_ampparms 
--

CREATE TABLE channelmap_ampparms(
    net           VARCHAR2(8)      NOT NULL,
    sta           VARCHAR2(6)      NOT NULL,
    seedchan      VARCHAR2(3)      NOT NULL,
    location      VARCHAR2(2)      NOT NULL,
    ondate        DATE             NOT NULL,
    offdate       DATE             NOT NULL,
    channel       VARCHAR2(3),
    channelsrc    VARCHAR2(8),
    clip          NUMBER(14, 2),
    lddate        DATE             DEFAULT (SYSDATE),
    CONSTRAINT cm_amp_key PRIMARY KEY (net, sta, seedchan, location, ondate)
)
;



COMMENT ON TABLE channelmap_ampparms IS 'Channel clipping count values (used by magnitude algorithms)'
;
COMMENT ON COLUMN channelmap_ampparms.net IS 'Unique network identifier. This character string is the name of a seismic network '
;
COMMENT ON COLUMN channelmap_ampparms.sta IS 'Station code. This is the common code-name of a seismic observatory. Generally only three or four characters are used '
;
COMMENT ON COLUMN channelmap_ampparms.seedchan IS 'SEED channel name. The first character denotes the band code, the second for the instrument code and the third represents the component code '
;
COMMENT ON COLUMN channelmap_ampparms.location IS 'Describes the individual sites on an array station, operated by the same network operator '
;
COMMENT ON COLUMN channelmap_ampparms.ondate IS 'This attribute denotes the start date '
;
COMMENT ON COLUMN channelmap_ampparms.offdate IS 'This attribute denotes the end date '
;
COMMENT ON COLUMN channelmap_ampparms.channel IS 'Channel name '
;
COMMENT ON COLUMN channelmap_ampparms.channelsrc IS 'Domain for channel. This specifies what naming convention is used for the channel name (i.e. SEED, USGS, etc.) '
;
COMMENT ON COLUMN channelmap_ampparms.clip IS 'Sample counts at which signal clips'
;
COMMENT ON COLUMN channelmap_ampparms.lddate IS 'Load date. Date and time that the record was created or last modified, in Oracle date datatype '
;
-- 
-- TABLE: channelmap_codaparms 
--

CREATE TABLE channelmap_codaparms(
    net           VARCHAR2(8)     NOT NULL,
    sta           VARCHAR2(6)     NOT NULL,
    seedchan      VARCHAR2(3)     NOT NULL,
    location      VARCHAR2(2)     NOT NULL,
    ondate        DATE            NOT NULL,
    offdate       DATE            NOT NULL,
    channel       VARCHAR2(3),
    channelsrc    VARCHAR2(8),
    cutoff        NUMBER(8, 2),
    gain_corr     NUMBER(6, 3),
    lddate        DATE            DEFAULT (SYSDATE),
    CONSTRAINT cm_coda_key PRIMARY KEY (net, sta, seedchan, location, ondate)
)
;



COMMENT ON TABLE channelmap_codaparms IS 'Channel response dependent data (used by coda magnitude algorithms)'
;
COMMENT ON COLUMN channelmap_codaparms.net IS 'Unique network identifier. This character string is the name of a seismic network '
;
COMMENT ON COLUMN channelmap_codaparms.sta IS 'Station code. This is the common code-name of a seismic observatory. Generally only three or four characters are used '
;
COMMENT ON COLUMN channelmap_codaparms.seedchan IS 'SEED channel name. The first character denotes the band code, the second for the instrument code and the third represents the component code '
;
COMMENT ON COLUMN channelmap_codaparms.location IS 'Describes the individual sites on an array station, operated by the same network operator '
;
COMMENT ON COLUMN channelmap_codaparms.ondate IS 'This attribute denotes the start date '
;
COMMENT ON COLUMN channelmap_codaparms.offdate IS 'This attribute denotes the end date '
;
COMMENT ON COLUMN channelmap_codaparms.channel IS 'Channel name '
;
COMMENT ON COLUMN channelmap_codaparms.channelsrc IS 'Domain for channel. This specifies what naming convention is used for the channel name (i.e. SEED, USGS, etc.) '
;
COMMENT ON COLUMN channelmap_codaparms.cutoff IS '2-sec averaged absolute value amplitude counts'
;
COMMENT ON COLUMN channelmap_codaparms.gain_corr IS 'Magnitude units correction'
;
COMMENT ON COLUMN channelmap_codaparms.lddate IS 'Load date. Date and time that the record was created or last modified, in Oracle date datatype'
;
-- 
-- TABLE: config_channel 
--

CREATE TABLE config_channel(
    progid      NUMBER(8, 0)    NOT NULL,
    net         VARCHAR2(8)     NOT NULL,
    sta         VARCHAR2(6)     NOT NULL,
    seedchan    VARCHAR2(3)     NOT NULL,
    config      VARCHAR2(64),
    lddate      DATE            DEFAULT (SYSDATE),
    location    VARCHAR2(2)     NOT NULL,
    CONSTRAINT config_chankey01 PRIMARY KEY (progid, net, sta, seedchan, location), 
    CONSTRAINT Refprogram85 FOREIGN KEY (progid)
    REFERENCES program(progid)
)
;



COMMENT ON TABLE config_channel IS 'Associates NSCL stream codes with programs (used in the sql_chanloader system)'
;
COMMENT ON COLUMN config_channel.progid IS 'Keys to CONFIG_CHANNEL table'
;
COMMENT ON COLUMN config_channel.net IS 'Unique network identifier. This character string is the name of a seismic network '
;
COMMENT ON COLUMN config_channel.sta IS 'Station code. This is the common code-name of a seismic observatory. Generally only three or four characters are used '
;
COMMENT ON COLUMN config_channel.seedchan IS 'SEED channel name. The first character denotes the band code, the second for the instrument code and the third represents the component code '
;
COMMENT ON COLUMN config_channel.config IS 'Misc note used by config file generation scripts.  Originally intended to identify configs within a program group'
;
COMMENT ON COLUMN config_channel.lddate IS 'Load date. Date and time that the record was created or last modified, in Oracle date datatype '
;
COMMENT ON COLUMN config_channel.location IS 'Describes the individual sites on an array station, operated by the same network operator '
;
-- 
-- TABLE: gazetteerbigtown 
--

CREATE TABLE gazetteerbigtown(
    gazid     NUMBER(16, 0)    NOT NULL,
    pop       NUMBER(10, 0),
    remark    VARCHAR2(80),
    lddate    DATE             DEFAULT (SYSDATE),
    CONSTRAINT gazbigtown_pk_gazid PRIMARY KEY (gazid), 
    CONSTRAINT gazbigtown_fk_gazid FOREIGN KEY (gazid)
    REFERENCES gazetteerpt(gazid)
)
;



COMMENT ON TABLE gazetteerbigtown IS 'Ancillary descriptive data for significant town entries in gazetteerpt table'
;
COMMENT ON COLUMN gazetteerbigtown.gazid IS 'References gazetteerpt.gazid'
;
COMMENT ON COLUMN gazetteerbigtown.pop IS 'Population >= 0'
;
COMMENT ON COLUMN gazetteerbigtown.remark IS 'Information about town'
;
COMMENT ON COLUMN gazetteerbigtown.lddate IS 'Load date. Date and time that the record was created or last modified, in Oracle date datatype '
;
-- 
-- TABLE: gazetteerfault 
--

CREATE TABLE gazetteerfault(
    gazid     NUMBER          NOT NULL,
    remark    VARCHAR2(80),
    lddate    DATE            DEFAULT (SYSDATE),
    CONSTRAINT gazfault_pk_gazid PRIMARY KEY (gazid), 
    CONSTRAINT gazfault_fk_gazid FOREIGN KEY (gazid)
    REFERENCES gazetteerline(gazid)
)
;



COMMENT ON TABLE gazetteerfault IS 'Ancillary descriptive data for fault entries in gazetteerpt table'
;
COMMENT ON COLUMN gazetteerfault.gazid IS 'References gazetteerpt.gazid'
;
COMMENT ON COLUMN gazetteerfault.remark IS 'Ancillary description of fault'
;
COMMENT ON COLUMN gazetteerfault.lddate IS 'Load date. Date and time that the record was created or last modified, in Oracle date datatype '
;
-- 
-- TABLE: gazetteerline 
--

CREATE TABLE gazetteerline(
    gazid     NUMBER          NOT NULL,
    type      NUMBER(3, 0)    NOT NULL,
    name      VARCHAR2(80)    NOT NULL,
    line      NUMBER          NOT NULL,
    format    VARCHAR2(16),
    points    BLOB,
    lddate    DATE            DEFAULT (SYSDATE),
    CONSTRAINT gazline_pk_gazid PRIMARY KEY (gazid), 
    CONSTRAINT gazline_fk_type FOREIGN KEY (type)
    REFERENCES gazetteertype(code)
)
;



COMMENT ON TABLE gazetteerline IS 'Graphical line segments are defined by series of binary lat,lon stored as BLOB type (for fault lines)'
;
COMMENT ON COLUMN gazetteerline.gazid IS 'References gazetteerpt.gazid'
;
COMMENT ON COLUMN gazetteerline.type IS 'References gazetteertype.code'
;
COMMENT ON COLUMN gazetteerline.name IS 'Name of line group'
;
COMMENT ON COLUMN gazetteerline.line IS 'Line group segment number (>=0)'
;
COMMENT ON COLUMN gazetteerline.format IS 'Known binary data byte type'
;
COMMENT ON COLUMN gazetteerline.points IS 'Binary data'
;
COMMENT ON COLUMN gazetteerline.lddate IS 'Load date. Date and time that the record was created or last modified, in Oracle date datatype '
;
-- 
-- TABLE: gazetteerpt 
--

CREATE TABLE gazetteerpt(
    gazid     NUMBER(16, 0)    NOT NULL,
    type      NUMBER(3, 0)     NOT NULL,
    lat       NUMBER(9, 7)     NOT NULL,
    lon       NUMBER(10, 7)    NOT NULL,
    z         NUMBER(7, 0),
    name      VARCHAR2(48)     NOT NULL,
    state     VARCHAR2(2),
    county    VARCHAR2(32),
    map       VARCHAR2(48),
    datumh    VARCHAR2(8),
    datumv    VARCHAR2(8),
    lddate    DATE             DEFAULT (SYSDATE),
    CONSTRAINT gazpt_pk_gazid PRIMARY KEY (gazid), 
    CONSTRAINT gazpt_fk_type FOREIGN KEY (type)
    REFERENCES gazetteertype(code)
)
;



COMMENT ON TABLE gazetteerpt IS 'Geographic points of interest described by lat,lon,z and other map location data'
;
COMMENT ON COLUMN gazetteerpt.gazid IS 'Derived from sequence gazseq'
;
COMMENT ON COLUMN gazetteerpt.type IS 'References gazetteertype.code'
;
COMMENT ON COLUMN gazetteerpt.lat IS 'Latitude must be within +/- 90'
;
COMMENT ON COLUMN gazetteerpt.lon IS 'Longitude must be within +/-180'
;
COMMENT ON COLUMN gazetteerpt.z IS 'Elevation (+ is above sea level)'
;
COMMENT ON COLUMN gazetteerpt.name IS 'Point place name'
;
COMMENT ON COLUMN gazetteerpt.state IS 'State where point is located'
;
COMMENT ON COLUMN gazetteerpt.county IS 'County where point is located'
;
COMMENT ON COLUMN gazetteerpt.map IS 'A map reference'
;
COMMENT ON COLUMN gazetteerpt.datumh IS 'Map horizontal datum (eg. WGS84)'
;
COMMENT ON COLUMN gazetteerpt.datumv IS 'Map vertical datum'
;
COMMENT ON COLUMN gazetteerpt.lddate IS 'Load date. Date and time that the record was created or last modified, in Oracle date datatype '
;
-- 
-- TABLE: gazetteerquake 
--

CREATE TABLE gazetteerquake(
    gazid     NUMBER(16, 0)    NOT NULL,
    remark    VARCHAR2(80)     NOT NULL,
    lddate    DATE             DEFAULT (SYSDATE),
    CONSTRAINT gazeq_pk_gazid PRIMARY KEY (gazid), 
    CONSTRAINT gazeq_fk_gazid FOREIGN KEY (gazid)
    REFERENCES gazetteerpt(gazid)
)
;



COMMENT ON TABLE gazetteerquake IS 'Ancillary descriptive data for earthquake entries in gazetteerpt table'
;
COMMENT ON COLUMN gazetteerquake.gazid IS 'References gazetteerpt.gazid'
;
COMMENT ON COLUMN gazetteerquake.remark IS 'Information about earthquake'
;
COMMENT ON COLUMN gazetteerquake.lddate IS 'Load date. Date and time that the record was created or last modified, in Oracle date datatype '
;
-- 
-- TABLE: gazetteerquarry 
--

CREATE TABLE gazetteerquarry(
    gazid     NUMBER(16, 0)    NOT NULL,
    remark    VARCHAR2(80)     NOT NULL,
    lddate    DATE             DEFAULT (SYSDATE),
    CONSTRAINT gazqry_pk_gazid PRIMARY KEY (gazid), 
    CONSTRAINT gazqry_fk_gazid FOREIGN KEY (gazid)
    REFERENCES gazetteerpt(gazid)
)
;



COMMENT ON TABLE gazetteerquarry IS 'Ancillary descriptive data for quarry entries in gazetteerpt table'
;
COMMENT ON COLUMN gazetteerquarry.gazid IS 'References gazetteerpt.gazid'
;
COMMENT ON COLUMN gazetteerquarry.remark IS 'Information about quarry'
;
COMMENT ON COLUMN gazetteerquarry.lddate IS 'Load date. Date and time that the record was created or last modified, in Oracle date datatype '
;
-- 
-- TABLE: gazetteertown 
--

CREATE TABLE gazetteertown(
    gazid     NUMBER(16, 0)    NOT NULL,
    pop       NUMBER(10, 0),
    remark    VARCHAR2(80),
    lddate    DATE             DEFAULT (SYSDATE),
    CONSTRAINT gaztown_pk_gazid PRIMARY KEY (gazid), 
    CONSTRAINT gaztown_fk_gazid FOREIGN KEY (gazid)
    REFERENCES gazetteerpt(gazid)
)
;



COMMENT ON TABLE gazetteertown IS 'Ancillary descriptive data for town entries in gazetteerpt table'
;
COMMENT ON COLUMN gazetteertown.gazid IS 'References gazetteerpt.gazid'
;
COMMENT ON COLUMN gazetteertown.pop IS 'Population >= 0'
;
COMMENT ON COLUMN gazetteertown.remark IS 'Information about town'
;
COMMENT ON COLUMN gazetteertown.lddate IS 'Load date. Date and time that the record was created or last modified, in Oracle date datatype '
;
-- 
-- TABLE: gazetteertype 
--

CREATE TABLE gazetteertype(
    code      NUMBER(3, 0)    NOT NULL,
    name      VARCHAR2(32)    NOT NULL,
    lddate    DATE            DEFAULT (SYSDATE),
    CONSTRAINT gaztype_pk_code PRIMARY KEY (code)
)
;



COMMENT ON TABLE gazetteertype IS 'Geographic map type keys and description'
;
COMMENT ON COLUMN gazetteertype.code IS 'A number tag'
;
COMMENT ON COLUMN gazetteertype.name IS 'A collective geographic type name'
;
COMMENT ON COLUMN gazetteertype.lddate IS 'Load date. Date and time that the record was created or last modified, in Oracle date datatype '
;
-- 
-- TABLE: jasieventlock 
--

CREATE TABLE jasieventlock(
    evid           NUMBER          NOT NULL,
    hostname       VARCHAR2(40),
    application    VARCHAR2(20),
    username       VARCHAR2(20),
    lddate         DATE,
    CONSTRAINT PK3 PRIMARY KEY (evid)
)
;



COMMENT ON TABLE jasieventlock IS 'Current event locks (used in Jiggle)'
;
COMMENT ON COLUMN jasieventlock.evid IS 'Event identifier. Each event is assigned a unique integer which identifies it in a database'
;
COMMENT ON COLUMN jasieventlock.hostname IS 'URL of computer that has locked the event'
;
COMMENT ON COLUMN jasieventlock.application IS 'Name of computer application that has locked the event'
;
COMMENT ON COLUMN jasieventlock.username IS 'Username on remote computer that has locked the event'
;
COMMENT ON COLUMN jasieventlock.lddate IS 'Load date. Date and time that the record was created or last modified, in Oracle date datatype '
;
-- 
-- TABLE: program 
--

CREATE TABLE program(
    progid    NUMBER(8, 0)    NOT NULL,
    name      VARCHAR2(16)    NOT NULL,
    lddate    DATE            DEFAULT (SYSDATE),
    CONSTRAINT progkey01 PRIMARY KEY (progid)
)
;



COMMENT ON TABLE program IS 'Maps Program Names to PROGID''s (used in sql_chanloader system('
;
COMMENT ON COLUMN program.progid IS 'Primary Key'
;
COMMENT ON COLUMN program.name IS 'Program name used in sql_chanloader system.  Example: AmpGen'
;
COMMENT ON COLUMN program.lddate IS 'Load date. Date and time that the record was created or last modified, in Oracle date datatype '
;
-- 
-- TABLE: request_card 
--

CREATE TABLE request_card(
    evid            NUMBER(15, 0),
    auth            VARCHAR2(15)      NOT NULL,
    subsource       VARCHAR2(8)       NOT NULL,
    net             VARCHAR2(8)       NOT NULL,
    sta             VARCHAR2(8)       NOT NULL,
    seedchan        VARCHAR2(8)       NOT NULL,
    staauth         VARCHAR2(15)      NOT NULL,
    channel         VARCHAR2(8)       NOT NULL,
    datetime_on     NUMBER(25, 10)    NOT NULL,
    datetime_off    NUMBER(25, 10)    NOT NULL,
    request_type    VARCHAR2(1)       NOT NULL,
    lddate          DATE              DEFAULT (SYSDATE),
    rcid            NUMBER(15, 0)     NOT NULL,
    location        VARCHAR2(2)       NOT NULL,
    retry           NUMBER(38, 0),
    lastretry       DATE,
    priority        NUMBER,
    CONSTRAINT request_cardkey01 PRIMARY KEY (rcid)
)
;



COMMENT ON TABLE request_card IS 'List of channel time windows to be archived'
;
COMMENT ON COLUMN request_card.evid IS 'Event identifier. Each event is assigned a unique integer which identifies it in a database'
;
COMMENT ON COLUMN request_card.auth IS 'The auth field specifies the source of the information. This may be a network identifier (FDSN or otherwise), or any other string indicating the source of the information in the record '
;
COMMENT ON COLUMN request_card.subsource IS 'A second identifier to specify the system or process that derived the data. e.g., the origin''s AUTH is CI, but the subsource (the solution) was computed by JIGGLE '
;
COMMENT ON COLUMN request_card.net IS 'Unique network identifier. This character string is the name of a seismic network '
;
COMMENT ON COLUMN request_card.sta IS 'Station code. This is the common code-name of a seismic observatory. Generally only three or four characters are used '
;
COMMENT ON COLUMN request_card.seedchan IS 'SEED channel name. The first character denotes the band code, the second for the instrument code and the third represents the component code '
;
COMMENT ON COLUMN request_card.staauth IS 'Purpose unknown (always same as subsource)'
;
COMMENT ON COLUMN request_card.channel IS 'Channel name'
;
COMMENT ON COLUMN request_card.datetime_on IS 'Start time of time window to save'
;
COMMENT ON COLUMN request_card.datetime_off IS 'End time of time window to save'
;
COMMENT ON COLUMN request_card.request_type IS 'Single character flag describing request type'
;
COMMENT ON COLUMN request_card.lddate IS 'Load date. Date and time that the record was created or last modified, in Oracle date datatype '
;
COMMENT ON COLUMN request_card.rcid IS 'Unique request row number. Derived from REQSEQ.'
;
COMMENT ON COLUMN request_card.location IS 'Describes the individual sites on an array station, operated by the same network operator '
;
COMMENT ON COLUMN request_card.retry IS 'Count of attempts to retrieve this waveform'
;
COMMENT ON COLUMN request_card.lastretry IS 'Time of last attempt to retrieve this waveform'
;
COMMENT ON COLUMN request_card.priority IS 'Rows are processed in priority order, 1 is highest priority'
;
-- 
-- TABLE: rt_role 
--

CREATE TABLE rt_role(
    primary_system       VARCHAR2(5),
    modification_time    DATE           DEFAULT (SYSDATE)
)
;



COMMENT ON TABLE rt_role IS 'This table is used to store information about the current status of the RT machine. RT System runs two machines in parallel. One is always ''primary'' and another is always ''shadow''. You can find out using this table if the machine in question is primary or shadow. Whenever the status of the RT machine change from ''primary'' to ''shadow'' or vice versa, the entry is created in the table with the timestamp'
;
COMMENT ON COLUMN rt_role.primary_system IS 'It stores (not enforced) two string values in the field. ''true'' and ''false''. If the value is ''true'', the system is primary and if the value is ''false'' the system is shadow'
;
COMMENT ON COLUMN rt_role.modification_time IS 'Time when status is updated'
;
-- 
-- TABLE: stamapping 
--

CREATE TABLE stamapping(
    net          VARCHAR2(8)     NOT NULL,
    sta          VARCHAR2(6)     NOT NULL,
    stanumber    NUMBER(8, 0)    NOT NULL,
    lddate       DATE,
    locdescr     VARCHAR2(40),
    CONSTRAINT stamapkey01 PRIMARY KEY (net, sta)
)
;



COMMENT ON TABLE stamapping IS 'Provides geographic station location descriptions and maps station names to station numbers for the Strong-Motion 

Community'
;
COMMENT ON COLUMN stamapping.net IS 'Unique network identifier. This character string is the name of a seismic network '
;
COMMENT ON COLUMN stamapping.sta IS 'Station code. This is the common code-name of a seismic observatory. Generally only three or four characters are used '
;
COMMENT ON COLUMN stamapping.stanumber IS 'Station Number'
;
COMMENT ON COLUMN stamapping.lddate IS 'Load date. Date and time that the record was created or last modified, in Oracle date datat'
;
COMMENT ON COLUMN stamapping.locdescr IS 'Geographic description of station location'
;
-- 
-- TABLE: unassocamp 
--

CREATE TABLE unassocamp(
    ampid         NUMBER(15, 0)       NOT NULL,
    commid        NUMBER(15, 0),
    datetime      NUMBER(25, 10)      NOT NULL,
    sta           VARCHAR2(6)         NOT NULL,
    net           VARCHAR2(8),
    auth          VARCHAR2(15)        NOT NULL,
    subsource     VARCHAR2(8),
    channel       VARCHAR2(8),
    channelsrc    VARCHAR2(8),
    seedchan      VARCHAR2(3),
    location      VARCHAR2(2),
    iphase        VARCHAR2(8),
    amplitude     DOUBLE PRECISION    NOT NULL,
    amptype       VARCHAR2(8),
    units         VARCHAR2(4)         NOT NULL,
    ampmeas       VARCHAR2(1),
    eramp         NUMBER(5, 3),
    flagamp       VARCHAR2(4),
    per           NUMBER(10, 4),
    snr           DOUBLE PRECISION,
    tau           NUMBER(9, 4),
    quality       NUMBER(2, 1),
    rflag         VARCHAR2(2),
    cflag         VARCHAR2(2),
    wstart        DOUBLE PRECISION    NOT NULL,
    duration      DOUBLE PRECISION    NOT NULL,
    lddate        DATE                DEFAULT (SYSDATE),
    CONSTRAINT unassocampkey01 PRIMARY KEY (ampid)
)
;



COMMENT ON TABLE unassocamp IS 'Stores imported unassociated amplitudes'
;
COMMENT ON COLUMN unassocamp.ampid IS 'Amplitude identification. Each amplitude is assigned a unique positive integer identifying it. This number is used in the AssocAmO relation along with the origin identifier to link Amp and Origin. This number is used also in the AssocAmM relation along with the magnitude identifier to link Amp and Netmag '
;
COMMENT ON COLUMN unassocamp.commid IS 'Comment identification. This is a key used to point to free-form comments entered in the Remark relation. These comments store additional information about a tuple in another relation. Within the Remark relation, there may be many tuples with the same commid and different lineno, but the same commid will appear in only one other tuple among the rest of the relations in the database '
;
COMMENT ON COLUMN unassocamp.datetime IS 'The date of associated with information in the record, in true epoch format '
;
COMMENT ON COLUMN unassocamp.sta IS 'Station code. This is the common code-name of a seismic observatory. Generally only three or four characters are used '
;
COMMENT ON COLUMN unassocamp.net IS 'Unique network identifier. This character string is the name of a seismic network '
;
COMMENT ON COLUMN unassocamp.auth IS 'The auth field specifies the source of the information. This may be a network identifier (FDSN or otherwise), or any other string indicating the source of the information in the record '
;
COMMENT ON COLUMN unassocamp.subsource IS 'A second identifier to specify the system or process that derived the data. e.g., the origin''s AUTH is CI, but the subsource (the solution) was computed by JIGGLE '
;
COMMENT ON COLUMN unassocamp.channel IS 'Channel name '
;
COMMENT ON COLUMN unassocamp.channelsrc IS 'Domain for channel. This specifies what naming convention is used for the channel name (i.e. SEED, USGS, etc.) '
;
COMMENT ON COLUMN unassocamp.seedchan IS 'SEED channel name. The first character denotes the band code, the second for the instrument code and the third represents the component code '
;
COMMENT ON COLUMN unassocamp.location IS 'Describes the individual sites on an array station, operated by the same network operator '
;
COMMENT ON COLUMN unassocamp.iphase IS 'Reported phase. This eight-character field holds the name initially given to a seismic phase. Standard seismological labels for the types of signals (or phases) are used (e.g., P, PKP, PcP, pP). Both upper and lower case letters are available and should be used when appropriate, for example, pP or PcP '
;
COMMENT ON COLUMN unassocamp.amplitude IS 'Amplitude in appropriate units for type '
;
COMMENT ON COLUMN unassocamp.amptype IS 'Amplitude type '
;
COMMENT ON COLUMN unassocamp.units IS 'Units of amplitude '
;
COMMENT ON COLUMN unassocamp.ampmeas IS 'Amplitude measure '
;
COMMENT ON COLUMN unassocamp.eramp IS 'Uncertainty in amplitude measurement '
;
COMMENT ON COLUMN unassocamp.flagamp IS 'This attribute is a flag to indicate whether amplitude is over P packet, S packet, entire waveform, etc '
;
COMMENT ON COLUMN unassocamp.per IS 'Signal period. This attribute is the period of the signal described by the amplitude record '
;
COMMENT ON COLUMN unassocamp.snr IS 'Signal-to-noise ratio. This is an estimate of the signal relative to that of the noise immediately preceding it '
;
COMMENT ON COLUMN unassocamp.tau IS 'Coda duration (F-P time) '
;
COMMENT ON COLUMN unassocamp.quality IS 'This attribute describes the completeness of the time window of data. A complete time window is 1.0, an incomplete time window is 0.0. If an incomplete time window has been human-reviewed and the analyst is confident that the peak amplitude was recorded and properly computed despite the presence of data gaps, the value is set to 0.5 to indicate the window contains data gaps, but is usable '
;
COMMENT ON COLUMN unassocamp.rflag IS 'This flag describes whether an observation was generated automatically, by a human, or has been finalized '
;
COMMENT ON COLUMN unassocamp.cflag IS 'This flag indicates whether the amplitude value is below noise, on scale or clipped '
;
COMMENT ON COLUMN unassocamp.wstart IS 'Start of time window of amplitude measurement '
;
COMMENT ON COLUMN unassocamp.duration IS 'Duration of amplitude reading '
;
COMMENT ON COLUMN unassocamp.lddate IS 'Load date. Date and time that the record was created or last modified, in Oracle date datatype '
;
