CalCOFI Drifter Realtime Webpage Info

From Locl
Revision as of 12:08, 25 June 2009 by Kirk ireson (talk | contribs) (New page: <h1>CalCOFI SVP Drifter Realtime Webpage Wiki</h1> NOTES AND THINGS TO KNOW ABOUT THE SVP REALTIME PAGE<br> Jun, 2009 Kirk Webpage: [http://www.icess.ucsb.edu/drifter/realtime-SVP/ SVP R...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

CalCOFI SVP Drifter Realtime Webpage Wiki

NOTES AND THINGS TO KNOW ABOUT THE SVP REALTIME PAGE
Jun, 2009 Kirk

Webpage: SVP Realtime Page


There are three main parts needed to display the data (details below):
1. Fetching the data (using Python script running on dub-locl)
2. Parsing the data (using PHP script running on website)
3. Displaying the data (using Javascript running on your browser)


1. FETCHING THE DATA

On dub-locl.icess.ucsb.edu in /localhome/kirk/scripts/ there is a script 'expect_script_to_fetch_argos_data.py'. It uses 'pexpect', a Python version of the 'expect' scripts, which allows you to script what would normally be an interactive terminal session. This is necessary in this case because we have to obtain the data via a telnet session.

  • There is essentially nothing to configure it, and it's well documented should you need to change anything. It is set to fetch the last 24hours worth of positions.
  • It may need to be updated with drifter numbers as more are sent drifting.
  • It is set to run every 6 hours via a "cron job" in the kirk account. To edit this job, as kirk, at the Terminal, type 'crontab -e' and use 'vi' style editing commands, or 'crontab -l' to just show it. (To become kirk, login as drift, then in a Terminal, type 'sudo su -' (then type the drift password) to become root, then 'su kirk' to become kirk.)
  • It saves the output of this session to /home/locl/file_sharing/SVP_CALCOFI_LATEST_DATA.txt on the ICESS network (which is accessed on dub-locl via /mnt/locl/, which should be mounted automatically if the system reboots, see /etc/fstab)

2. PARSING THE DATA

When someone visits the webpage (http://www.icess.ucsb.edu/drifter/realtime-SVP/), in the ajax.js file there is instruction to fetch the data. This 'fetch' is accomplished by calling 'parse_argos_data.php' in that directory. This php script reads the file saved above (in /home/locl/), ignores all the non-data lines, and processes/cleans up the crazy ARGOS format output from the telnet session.

It outputs 1 record per position report in this format: drift_no,YY-MM-DD,HH:MM:SS,milliseconds_since_Jan01_1970,orig_report_num,lat,lon,position_type(1=GPS,0=ARGOS),SST(C),batt(V) e.g.

75428,2007-04-03,10:33:37,1175610817000,137,+26.6979,-081.9557,1,NaN,12.4   (a gps position)

3. DISPLAYING THE DATA (at realtime page)

The Google mapping code was adapted from the Iridium/Microstar realtime page at http://www.icess.ucsb.edu/drifter/realtime/

The two main javascript files are ajax.js and map.js.

The javascript files are compressed using http://www.icess.ucsb.edu/drifter/realtime/JavascriptCompressor.html, so changes made to the xxx__UNCOMPRESSED__.js files won't show up on the page unless they are compressed and saved without the "__UNCOMPRESSED__" portion in the name, OR at the beginning of index.php those two types of files are commented/uncommented out as appropriate.


POTENTIAL PROBLEMS / TROUBLESHOOTING

Prob: The data file (/home/locl/file_sharing/SVP_CALCOFI_LATEST_DATA.txt) is not getting saved/updated

  • Is the dub-locl computer up?
  • Is /mnt/locl mounted on dub-locl? It should come up automatically
  • Has 6 hours passed since the last time it ran? It only runs every 6 hours
  • Try fetching the data yourself via telnet (do these commands at a terminal prompt):
telnet datadist.argosinc.com
hansen     (at the 'Username:' prompt)
aomlus     (at the 'Password:' prompt)
prv,7325,ds,,93561-93587   (at the '/' prompt, to get the previous 9 day's worth of data for drifter #93561-93587 )   
lo   (at the '/' prompt, to log out)  

NOTE: if you want to get data from a specific time period, use julian dates and GMT hours after the comma after 'ds'. For example:

prv,7325,ds,174/12-175/10,93561-93587   (for June 23rd at 12Z through June 24th at 10Z)


Prob: The data file (/home/locl/file_sharing/SVP_CALCOFI_LATEST_DATA.txt) shows no data

  • There probably aren't any drifters talking in the last 24hours (look for the line "No data available or authorization failure" in the file or try manually getting the data)