Notes on running particle drifter inputs into a Xenia version 2 database instance and their corresponding display.
Worked through most of how to take Charlton's old particle drifter process and run it against a xenia (version 2) instance. The following notes should describe everything needed to get the drifter flows from horizon marine (
http://www.horizonmarine.com/ioos/seacoos.txt ) or aoml (
http://cromwell.marine.unc.edu/drifters/aoml_drifters.txt ) populating into a local xenia_v2 instance.
Create the database instance
Download the xenia_v2
sql
#as user postgres
createdb db_xenia_v2
psql -U postgres -d db_xenia_v2 -f db_xenia_v2_simple_schema.sql
Add postgis capabilities
###add postgis capabilities to db
#use your filepath to associated postgis files below
createlang plpgsql db_xenia_v2
psql -d db_xenia_v2 -f /usr/local/pgsql/share/contrib/postgis.sql #or lwpostgis.sql
psql -d db_xenia_v2 -f /usr/local/pgsql/share/contrib/spatial_ref_sys.sql
Initial database table population and function/trigger setup
#download and run this
sql to populate the data dictionary tables
#download and run this
sql to add the necessary postgis columns to the multi_obs table, corresponding line segment function and initial organization/platform/sensor lookups
Data feeds and conversion to SQL
The following perl scripts use the perl DBI package. You'll need to modify the server/filepath/database particulars to your configuration.
The output sql file is currently hardcoded to be 'test.sorted.sql' but can be changed as needed. Note that the initial output is simply 'test' but this is passed to the unix 'sort' routine which gives a chronologically sorted increasing file listing which is critical to the proper database population order to produce the appropriate connected line segments.
The following input fields are ignored
One of the main differences from the original scripts is that running against the Xenia instance, a drifter is treated as a moving platform and the platform_handle is like 'horizon_marine:01712:drifter' where the drifter id is treated as the platform.short_name and used to uniquely identify the platform. If a new drifter id is included in the input stream, the script will recognize this and automatically add the corresponding new platform_id and sensor_id(s).
Horizon Marine
The following
perl script will take this
sample file or the same formatted live stream listed above and create a sql file for populating the database.
To create the sql file
perl process_file_xenia_hm sample_hm.txt
AOML
The following
perl script will take this
sample file or the same formatted live stream listed above and create a sql file for populating the database.
To create the sql file
perl process_file_xenia_hm sample_hm.txt
The differences between the AOML conversion and HM are
- the organization references
- the choice of string to indicate a commented/ignored line
- no polar to compass-rose conversion needed
- -NaN degree indicating no movement are ignored for position tracking purposes
Display
The following minimal test mapserver
mapfile was used with shp2img to verify the particle trajectory producing the below image.
/usr2/installation_files/mapserver-4.1/shp2img -m drifter.map -o drifter.png
In the test mapfile note to change the EXTENT argument so that the particle trajectories are visible within the extents. You'll need to change the server/filepaths as needed. I also have included the second and third map layers which reference only 'the_geom' but am not sure if or how they are utilized in the existing seacoos setup.
The first map layer display works by using an OUTLINE statement on the 'the_geom_line' column to graph the line segments according to their respective drifter speed for that segment.
--
JeremyCothran - 16 Dec 2006
to top