org.opensha.sha.cybershake.db
Class CybershakeSiteInfo2DB

java.lang.Object
  extended by org.opensha.sha.cybershake.db.CybershakeSiteInfo2DB

public class CybershakeSiteInfo2DB
extends Object


Field Summary
static double CUT_OFF_DISTANCE
           
 
Constructor Summary
CybershakeSiteInfo2DB(DBAccess db)
           
 
Method Summary
 void closeWriter()
           
 ArrayList<CybershakeSite> getAllSitesFromDB()
          Gets all CybershakeSite's from the Database
 ArrayList<String> getCS_SitesList()
           
 LocationList getCS_SitesListLocations()
           
 int getCybershakeSiteId(double lat, double lon)
          Returns the Cybershake site id for the corresponding location with given Lat and Lon.
 int getCybershakeSiteId(String cybershakeShortSiteName)
          Returns the CyberShake site id for the corresponding Cybershake short site name in the database
 Location getCyberShakeSiteLocation(String csSiteName)
           
 int getMatchedCSSourceID(ERF eqkRupForecast, int erfID, int erfSourceID)
           
 ArrayList<Integer> getRupIDsForSite(String csSiteName, int erfID, int srcID)
           
 CybershakeSite getSiteFromDB(int siteID)
          Gets a CybershakeSite from the Database
 CybershakeSite getSiteFromDB(String shortName)
          Gets a CybershakeSite from the Database
 ArrayList<Integer> getSrcIDsForSite(String csSiteName, int erfID)
           
static void main(String[] args)
           
 int putCybershakeLocationInDB(String siteName, String siteShortName, double siteLat, double siteLon)
          Puts the Cybershake locations in the database
 void putCyberShakeLocationRegionalBounds(ERF eqkRupForecast, int erfId, int siteId, double locLat, double locLon, boolean update)
          Computes the regional bounds for the given cybershake and puts in the database.
 ArrayList<int[]> putCyberShakeLocationSrcRupInfo(ERF eqkRupForecast, int erfId, int siteId, double locLat, double locLon)
          Finds all the ruptures that have any location on their surface within Cybershake location circular regional bounds.
 ArrayList<int[]> putCyberShakeLocationSrcRupInfo(ERF eqkRupForecast, int erfId, int siteId, double locLat, double locLon, boolean checkAddRup)
          Finds all the ruptures that have any location on their surface within Cybershake location circular regional bounds with option to add ruptures that are not already in database.
 ArrayList<int[]> putCyberShakeLocationSrcRupInfo(ERF eqkRupForecast, int erfId, int siteId, double locLat, double locLon, boolean checkAddRup, String addLogFileName)
          Finds all the ruptures that have any location on their surface within Cybershake location circular regional bounds with option to add ruptures that are not already in database (with logging).
 void setForceAddRuptures(boolean force)
           
 void setMatchSourceNames(boolean match)
           
 void setSkipToRup(int rup)
           
 void setSkipToSource(int source)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CUT_OFF_DISTANCE

public static double CUT_OFF_DISTANCE
Constructor Detail

CybershakeSiteInfo2DB

public CybershakeSiteInfo2DB(DBAccess db)
Method Detail

setMatchSourceNames

public void setMatchSourceNames(boolean match)

putCybershakeLocationInDB

public int putCybershakeLocationInDB(String siteName,
                                     String siteShortName,
                                     double siteLat,
                                     double siteLon)
Puts the Cybershake locations in the database

Parameters:
siteName -
siteShortName -
siteLat -
siteLon -
Returns:
the SiteId from the database

getCybershakeSiteId

public int getCybershakeSiteId(String cybershakeShortSiteName)
Returns the CyberShake site id for the corresponding Cybershake short site name in the database

Parameters:
cybershakeShortSiteName -
Returns:

getCybershakeSiteId

public int getCybershakeSiteId(double lat,
                               double lon)
Returns the Cybershake site id for the corresponding location with given Lat and Lon.

Parameters:
lat -
lon -
Returns:

putCyberShakeLocationSrcRupInfo

public ArrayList<int[]> putCyberShakeLocationSrcRupInfo(ERF eqkRupForecast,
                                                        int erfId,
                                                        int siteId,
                                                        double locLat,
                                                        double locLon)
Finds all the ruptures that have any location on their surface within Cybershake location circular regional bounds.

Parameters:
erf -
erfId -
siteId -
locLat -
locLon -

putCyberShakeLocationSrcRupInfo

public ArrayList<int[]> putCyberShakeLocationSrcRupInfo(ERF eqkRupForecast,
                                                        int erfId,
                                                        int siteId,
                                                        double locLat,
                                                        double locLon,
                                                        boolean checkAddRup)
Finds all the ruptures that have any location on their surface within Cybershake location circular regional bounds with option to add ruptures that are not already in database.

Parameters:
erf -
erfId -
siteId -
locLat -
locLon -
checkAddRup - make sure rupture is in DB, and if not, add it

getMatchedCSSourceID

public int getMatchedCSSourceID(ERF eqkRupForecast,
                                int erfID,
                                int erfSourceID)

putCyberShakeLocationSrcRupInfo

public ArrayList<int[]> putCyberShakeLocationSrcRupInfo(ERF eqkRupForecast,
                                                        int erfId,
                                                        int siteId,
                                                        double locLat,
                                                        double locLon,
                                                        boolean checkAddRup,
                                                        String addLogFileName)
Finds all the ruptures that have any location on their surface within Cybershake location circular regional bounds with option to add ruptures that are not already in database (with logging).

Parameters:
erf -
erfId -
siteId -
locLat -
locLon -
checkAddRup - make sure rupture is in DB, and if not, add it
addLogFileName - filename to log to (no logging if empty)

setSkipToSource

public void setSkipToSource(int source)

setSkipToRup

public void setSkipToRup(int rup)

setForceAddRuptures

public void setForceAddRuptures(boolean force)

closeWriter

public void closeWriter()

putCyberShakeLocationRegionalBounds

public void putCyberShakeLocationRegionalBounds(ERF eqkRupForecast,
                                                int erfId,
                                                int siteId,
                                                double locLat,
                                                double locLon,
                                                boolean update)
Computes the regional bounds for the given cybershake and puts in the database. Also put the ruptureId and sourceId from ERF that dictates the min/max lat/lon for the region.

Parameters:
eqkRupForecast -
erfId -
siteId -
locLat -
locLon -
update - - update bounds, don't reinsert

getCS_SitesList

public ArrayList<String> getCS_SitesList()
Returns:
the list of cybershake sites

getCS_SitesListLocations

public LocationList getCS_SitesListLocations()
Returns:
the list of all Cybershake Site Locations

getSrcIDsForSite

public ArrayList<Integer> getSrcIDsForSite(String csSiteName,
                                           int erfID)
Parameters:
siteShortName - short site name as in database for Cybershake site
Returns:
the Earthquake rupture forecast source id's for a given cybershake site.

getRupIDsForSite

public ArrayList<Integer> getRupIDsForSite(String csSiteName,
                                           int erfID,
                                           int srcID)
Parameters:
siteShortName -
srcId -
Returns:
the list of rupture ids

getCyberShakeSiteLocation

public Location getCyberShakeSiteLocation(String csSiteName)
Parameters:
csSiteName -
Returns:
the Geographic locaton for the given Cybershake site

getSiteFromDB

public CybershakeSite getSiteFromDB(String shortName)
Gets a CybershakeSite from the Database

Parameters:
shortName -
Returns:

getSiteFromDB

public CybershakeSite getSiteFromDB(int siteID)
Gets a CybershakeSite from the Database

Parameters:
shortName -
Returns:

getAllSitesFromDB

public ArrayList<CybershakeSite> getAllSitesFromDB()
Gets all CybershakeSite's from the Database

Returns:

main

public static void main(String[] args)