public class ObserveSql extends AbstractSql
Column | Type | Modifiers -----------+-----------------------------+----------- date | timestamp without time zone | not null dateobs | timestamp without time zone | not null instrument | smallint | iversion | smallint | exptime | real | amplmode | character(8) | pressure | real | dettemp | real | cryotemp | real | austatus | smallint | auseeing | real | domestat | boolean | observer | smallint | transfered | boolean | online | boolean | filename | character varying(255) | path | character varying(255) | imagetyp | smallint | object | character varying(255) | telfocus | real | objname | character varying(255) | azimuth | real | telalt | real | ambtemp | real | relhum | real | maxwind | real | telescop | character(8) | naquire | smallint | guideloss | real | tempm1 | real | tempm2 | real | avrgwind | real | winddir | real | atmpress | real | dewpoint | real | aumiss | real | seseff | real | snest | real | aulight | real | aulign | real | objid | character varying(255) | azfirst | real | altfirst | real | aztotal | real | ztotal | real | ADU_av | real | ADU_var | real | ADU_CNM3 | real | ADU_CNM4 | real | ADU_CNM5 | real | ADU_CNM6 | real | FILTER | character(8) | TELDEROT | real | EXPID | integer | TARGETID | character varying(255) | Indexes: "obs_pkey" primary key, btree (dateobs)The fields mean the following:
HistorySql.TargetSqlHistorySql
| Modifier and Type | Class and Description |
|---|---|
static class |
ObserveSql.Adu
Connects to the database and returns the ADU statistic for all files of
the stated telescope.
|
static class |
ObserveSql.AduStat
Connects to the database and returns the ADU statistic for all files of
the stated telescope.
|
static class |
ObserveSql.Ambient
Update ambient temperature.
|
static class |
ObserveSql.Coco
On coco, we reestablish directory structure for 2010 archive raw data.
|
static class |
ObserveSql.Duplicates
Removes double entries in the obs table, which slipped into it during
psql upgrade in Feb.
|
static class |
ObserveSql.Extract
A class to retrive columns from a database and output it into an
ascii-file for e.g.
|
static class |
ObserveSql.FitsParse
Only in debug mode, we read the fits file and print out what
would be
entered.
|
static class |
ObserveSql.FitsPut
Only for none-enterd fits, to be executed on wifsip/archive this
class
enters all found in the fits headers into the db.
|
static class |
ObserveSql.Flat
Connects to the database and tries to find flats with a stuck
filterwheel.
|
static class |
ObserveSql.Path
Checks all non-transferred files if they are present in the local
archive.
|
static class |
ObserveSql.Retrieve
Connects to the database and gets all values for the given unique object
ID.
|
static class |
ObserveSql.Types
Enum version of image types.
|
AbstractSql.ColumnsPropertyResources.Load, PropertyResources.URLResource| Modifier and Type | Field and Description |
|---|---|
static String |
BIASTYPE
The image type qualifier for scientific observations.
|
static String |
CALIBRATIONTYPE
The image type qualifier for scientific observations.
|
static String |
DARKTYPE
The image type qualifier for scientific observations.
|
private static String |
DEFADU1
The key to the field name for the ADU moment of that order.
|
private static String |
DEFADU2
The key to the field name for the ADU moment of that order.
|
private static String |
DEFADU3
The key to the field name for the ADU moment of that order.
|
private static String |
DEFADU4
The key to the field name for the ADU moment of that order.
|
private static String |
DEFADU5
The key to the field name for the ADU moment of that order.
|
private static String |
DEFADU6
The key to the field name for the ADU moment of that order.
|
private static String |
DEFDATEOBSFIELD
The default target name field in the database
|
private static String |
DEFEXPID
The key to the unique exposure identifier.
|
private static String |
DEFEXPTIMEFIELD
The default target name field in the database
|
private static String |
DEFFILENAME
The key to the filename field.
|
private static String |
DEFFILTER
The key to color filter used.
|
private static String |
DEFIMAGETYPEFIELD
The default target name field in the database
|
private static String |
DEFINSTRUMENT
The key to the unique exposure identifier.
|
private static String |
DEFIVERSION
The key to the unique exposure identifier.
|
private static String |
DEFOBSERVER
The key to the observer integer field.
|
private static String |
DEFPATH
The key to the path field.
|
private static String |
DEFSIMBADNAMEFIELD
The default simbad name field in the database
|
private static String |
DEFTABLE
The default table name.
|
private static String |
DEFTARGETNAMEFIELD
The default target name field in the database
|
private static String |
DEFTARGETUNIQUE
The key to the unique target identifier.
|
private static String |
DEFTELDEROT
The key to color filter used.
|
private static String |
DEFTELESCOPEFIELD
The default target name field in the database
|
private static String |
DEFTRANSFERRED
The key to the trasnferred field.
|
private static String |
DEFUNIQUEFIELD
The default target name field in the database
|
static String |
FLATFIELDTYPE
The image type qualifier for scientific observations.
|
private static Map<String,Integer> |
IMAGETYPES
Mapping of image type numbers to image type qualifiers.
|
static String |
INSTRUME
The header key holding instrument and version number as a string.
|
private static Map<String,Integer> |
INSTYPES
Mapping of instrument names to instrument type qualifiers.
|
static String |
KEY_ADU1
The key to the field name for the ADU moment of that order.
|
static String |
KEY_ADU2
The key to the field name for the ADU moment of that order.
|
static String |
KEY_ADU3
The key to the field name for the ADU moment of that order.
|
static String |
KEY_ADU4
The key to the field name for the ADU moment of that order.
|
static String |
KEY_ADU5
The key to the field name for the ADU moment of that order.
|
static String |
KEY_ADU6
The key to the field name for the ADU moment of that order.
|
static String |
KEY_ADUBOX
If set, this points to a box for moments calculation.
|
static String |
KEY_DATEOBSFIELD
The key to the target name in the database.
|
static String |
KEY_EXPID
The key to the unique exposure identifier.
|
static String |
KEY_EXPTIMEFIELD
The key to the target name in the database.
|
static String |
KEY_FILENAME
The key to the filename field.
|
static String |
KEY_FILTER
The key to the field name for the ADU moment of that order.
|
static String |
KEY_IMAGETYPEFIELD
The key to the imagetype field.
|
static String |
KEY_INSTRUMENT
The key to the instrument int.
|
static String |
KEY_IVERSION
The key to the instrument version.
|
static String |
KEY_LOCALNFS
A mapping of archive path to local accessible ones.
|
static String |
KEY_OBSERVER
The key to the observer integer field.
|
static String |
KEY_PATH
The key to the path field.
|
static String |
KEY_SIMBADNAMEFIELD
The key to the Simbad object name in the database.
|
static String |
KEY_TARGETNAMEFIELD
The key to the target name in the database.
|
static String |
KEY_TARGETUNIQUE
The key to the unique target identifier.
|
static String |
KEY_TELDEROT
The key to the field name for the ADU moment of that order.
|
static String |
KEY_TELESCOPEFIELD
The key to the telescope name in the database.
|
static String |
KEY_TRANSFERRED
The key to the transferred field.
|
static String |
KEY_UNIQUEFIELD
The key to the unique observation ID in the database.
|
private static Map<String,String> |
KEYCOLUMN
Mapping of HDU header keys to column names.
|
static String |
PREFIX_ADU
The prefix for the ADU keys.
|
static String |
SCIENCETYPE
The image type qualifier for scientific observations.
|
static String |
SKYTYPE
The image type qualifier for sky observations.
|
static String |
UNKNOWNTYPE
The image type qualifier for scientific observations.
|
KEY_TABLE, SQLBATCHDIR, SQLFAILDIRKEY_NOINITONCREATE, POSTFIX_ALPHABET, POSTFIX_BYTES, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_MODTIME, POSTFIX_URLKEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATORKEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOMECONFIG, KEY_CLASS| Constructor and Description |
|---|
ObserveSql(Map<String,String> prop)
Sets the properties of the history database and adds my defaults.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
enterFits(String unique,
File f)
Grabs a fits file and enters all fields it can, if this is the first
encounter of the exposure.
|
boolean |
enterFits(String unique,
File fits,
Rectangle box)
Grabs a fits file and enters all fields it can, if this is the first
encounter of the exposure.
|
private boolean |
enterFits(String unique,
File fits,
Rectangle box,
boolean force)
Grabs a fits file and enters all fields it can.
|
double[] |
getAduArray(String unique,
String adufield)
Retrieves an sql-array with the specified field name as a primitive
float[].
|
double[] |
getAduArray(String table,
String ufield,
String uval,
String adufield)
Static version, specfying also table and field name.
|
Date |
getDateFromUnique(String unique)
Gets the dateobs-field for the specified unique.
|
Date |
getDateFromUnique(String unique,
String ufield,
String dfield)
Gets the dateobs-field for the specified unique.
|
private int |
getExpId(File fits)
Get exposure id from file name.
|
static File |
getFileFromUnique(String unique)
Gets the file name from the object id.
|
File |
getFileFromUnique(String unique,
String ufield,
String pfield,
String ffield)
Gets the file name from the object id.
|
Date |
getLastScienceObservation(String tel,
String filter)
Returns the date the questioned filter was last observed on the specified
telescope.
|
File |
getLocalFileFromUnique(String unique)
From the path and filename saved in the db, we have the possibility to
divert to a local file name, if the nfs property is set.
|
Object |
getMapping(String unique,
String field)
Returns the mapping of the requested column names to the stated unique in
the obs table.
|
Map<String,Object> |
getMappings(String unique,
Collection<String> f)
Returns the mapping of the requested column names to the stated unique in
the obs table.
|
private String |
getObjid(String unique,
File fits)
Returns the unique objid from the unique target id and a file name.
|
Map<String,Map<String,Object>> |
getObservationForPick(String unique)
Returns a mapping of columns names to parsed java objects for the
required unique pick id
|
private Map<String,Map<String,Object>> |
getObservationMappings(String w)
Returns a mapping of unique ID's to observational parameters (as maps)
for all observations between the stated dates.
|
Map<String,Map<String,Object>> |
getObservations(Date from,
Date to)
Returns a mapping of unique ID's to observational parameters (as maps)
for all observations between the stated dates.
|
Map<String,Map<String,Object>> |
getObservations(Date from,
Date to,
int type)
Returns a mapping of unique ID's to observational parameters (as maps)
for all observations between the stated dates.
|
Map<String,Map<String,Object>> |
getObservations(Date from,
Date to,
int type,
String t)
Returns a mapping of unique ID's to observational parameters (as maps)
for all observations between the stated dates.
|
Map<String,Map<String,Object>> |
getObservations(Date from,
Date to,
String type)
Returns a mapping of unique ID's to observational parameters (as maps)
for all observations between the stated dates.
|
Map<String,Map<String,Object>> |
getObservations(String tel,
Date from,
Date to)
Returns a mapping of unique ID's to observational parameters (as maps)
for all observations between the stated dates.
|
double |
getScienceOpen(String tel,
Date from,
Date to) |
double |
getShutterOpen(String tel,
Date from,
Date to) |
private Map<String,Object> |
headerInfo(MHeader h)
We read all key/value pair in the header and then try to get values to
the entries in
KEYCOLUMN. |
boolean |
isFitsEntry(String unique,
File fits)
Test, if for a given file an entry already exists in the table.
|
boolean |
removeObservationFromDatabase(String unique)
Removes an entry from the observe db if the unique specifier is given.
|
private Map<String,Map<String,Object>> |
resultToMapping(ResultSet rs)
We take a result set and convert each row into a mapping of column names
to Java objects.
|
private String |
spanWhere(Date from,
Date to) |
private double |
sumExposureTime(String where) |
private String |
telWhere(String tel) |
private String |
typeWhere(int type) |
(package private) String |
where(Date from,
Date to,
int type) |
(package private) String |
where(String tel,
Date from,
Date to) |
(package private) String |
where(String tel,
Date from,
Date to,
int type) |
delete, distinct, distinct, exit, getAccess, getDefaultArchive, getDefaultFormat, getTable, init, insert, isEntry, release, release, replace, retrieve, retrieve, retrieve, single, singleclone, createFrom, createFrom, createFrom, createInstance, getApplet, getAsResources, getLocate, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, hasLocalURLs, initProperties, keyCreate, keyCreate, reload, setAppletaugment, augment, augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, parseObject, reload, removeProperty, requires, rescanned, setObject, setProperties, setProperty, stringProperties, toStringequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdefaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringPropertiespublic static final String INSTRUME
public static final String SKYTYPE
public static final String SCIENCETYPE
public static final String FLATFIELDTYPE
public static final String CALIBRATIONTYPE
public static final String BIASTYPE
public static final String DARKTYPE
public static final String UNKNOWNTYPE
public static final String KEY_UNIQUEFIELD
public static final String KEY_TARGETNAMEFIELD
public static final String KEY_TELESCOPEFIELD
public static final String KEY_DATEOBSFIELD
public static final String KEY_EXPTIMEFIELD
public static final String KEY_IMAGETYPEFIELD
public static final String KEY_SIMBADNAMEFIELD
public static final String KEY_TARGETUNIQUE
public static final String KEY_EXPID
public static final String KEY_INSTRUMENT
public static final String KEY_IVERSION
public static final String KEY_FILENAME
public static final String KEY_PATH
public static final String KEY_TRANSFERRED
public static final String KEY_OBSERVER
public static final String KEY_ADUBOX
public static final String KEY_ADU1
public static final String KEY_ADU2
public static final String KEY_ADU3
public static final String KEY_ADU4
public static final String KEY_ADU5
public static final String KEY_ADU6
public static final String KEY_FILTER
public static final String KEY_TELDEROT
public static final String KEY_LOCALNFS
public static final String PREFIX_ADU
private static final Map<String,String> KEYCOLUMN
private static final Map<String,Integer> IMAGETYPES
private static final Map<String,Integer> INSTYPES
private static final String DEFTABLE
private static final String DEFTELESCOPEFIELD
private static final String DEFTARGETNAMEFIELD
private static final String DEFSIMBADNAMEFIELD
private static final String DEFUNIQUEFIELD
private static final String DEFDATEOBSFIELD
private static final String DEFEXPTIMEFIELD
private static final String DEFIMAGETYPEFIELD
private static final String DEFINSTRUMENT
private static final String DEFIVERSION
private static final String DEFFILENAME
private static final String DEFPATH
private static final String DEFTRANSFERRED
private static final String DEFOBSERVER
private static final String DEFADU1
private static final String DEFADU2
private static final String DEFADU3
private static final String DEFADU4
private static final String DEFADU5
private static final String DEFADU6
private static final String DEFTARGETUNIQUE
private static final String DEFEXPID
private static final String DEFFILTER
private static final String DEFTELDEROT
public final boolean removeObservationFromDatabase(String unique)
public Map<String,Map<String,Object>> getObservationForPick(String unique)
public Map<String,Map<String,Object>> getObservations(Date from, Date to)
public Map<String,Map<String,Object>> getObservations(String tel, Date from, Date to)
public Map<String,Map<String,Object>> getObservations(Date from, Date to, String type)
public Map<String,Map<String,Object>> getObservations(Date from, Date to, int type)
public Map<String,Map<String,Object>> getObservations(Date from, Date to, int type, String t)
public double getShutterOpen(String tel, Date from, Date to) throws SQLException
SQLExceptionpublic double getScienceOpen(String tel, Date from, Date to) throws SQLException
SQLExceptionprivate double sumExposureTime(String where) throws SQLException
SQLExceptionprivate Map<String,Map<String,Object>> getObservationMappings(String w)
private String typeWhere(int type)
String where(String tel, Date from, Date to, int type)
from - to - type - tel - public Date getLastScienceObservation(String tel, String filter)
select dateobs from obs where telescop='STELLA1' and
"FILTER" = 'rp' and imagetyp = 1 order by dateobs descprivate String getObjid(String unique, File fits)
private int getExpId(File fits)
public Object getMapping(String unique, String field)
public Map<String,Object> getMappings(String unique, Collection<String> f)
public Date getDateFromUnique(String unique) throws SQLException
SQLExceptionpublic Date getDateFromUnique(String unique, String ufield, String dfield) throws SQLException
SQLExceptionpublic File getLocalFileFromUnique(String unique) throws SQLException
SQLExceptionpublic static File getFileFromUnique(String unique) throws SQLException
SQLExceptionpublic File getFileFromUnique(String unique, String ufield, String pfield, String ffield) throws SQLException
SQLExceptionpublic double[] getAduArray(String unique, String adufield) throws SQLException
ArrayTool.SQLExceptionpublic double[] getAduArray(String table, String ufield, String uval, String adufield) throws SQLException
SQLExceptionpublic boolean isFitsEntry(String unique, File fits) throws SQLException
SQLExceptionpublic boolean enterFits(String unique, File f) throws SQLException
SQLExceptionpublic boolean enterFits(String unique, File fits, Rectangle box) throws SQLException
SQLExceptionprivate boolean enterFits(String unique, File fits, Rectangle box, boolean force) throws SQLException
force - If true, we overwrite an old entry with same objidSQLExceptionprivate Map<String,Object> headerInfo(MHeader h)
KEYCOLUMN. All non-null values are parsed to
appropriate objects and put as values to the column names.private Map<String,Map<String,Object>> resultToMapping(ResultSet rs) throws SQLException
SQLException