14. 2. Shore Side Data System (600031 and 900823) : Instrument Swap on Oasis Mooring This page last changed on Jun 16, 2009 by mccann. This is the procedure to take when OSG swaps an instrument on an OASIS mooring in order to keep the metadata and data all lined up in SSDS. The easiest way is to try to do these steps exactly when they actually do the instrument swap. The reason is that due to the fact that the data from the instrument is downloaded to the same file in the OASIS directory so there is no way (currently) to automate some sort of notice that the instrument has been swapped. An external process reads that raw data file from the instrument, looks up the device ID from a shore-side configuration file and then publishes that data to SSDS under that device ID. If the timing is not right, some extra steps need to be taken. These steps will assume that the timing is correct and I will add steps at the end in case this is being done after the swap happened (usually the case). Get new device ID of the new instrument to be installed. Check out the XML for that instrument from the 'puckxml' project in CVS. Use a validating XML editor like XML Spy, oXygen, or jEdit to open the XML file. Make sure the schema location at the top of the XML file points to: http://new-ssds.mbari.org/ssds-docs/xml/schema/SSDS_Metadata.xsd Run the editor's validation on the XML. If it does not validate, fix errors Remove any deployment attributes from the <Deployment> tag. For instance any nominalLat/Lon/Depth. The one exception is the nominalDepth, if it is known please set it. If the <Deployment> tag has a 'name' attribute, make sure it does not have any deployment specific information in it. For example, 'ISUS Deployment' is better than 'M2 ISUS Deployment'. The reason for removing any deployment information from the XML is so that when the device moves to a different mooring, the user should not have to edit the XML. The goal is to get all the XML to a point where it never needs to be edited when an instrument is deployed (unless something in the way the data stream is generated from the instrument changes). Go to the SSDS Device pages and verify that the all the device information (mfg, model, serial number, name, type, etc.) matches what is currently in SSDS. If any of those are different it will update the device information in SSDS when the XML comes in the data stream. Verify RecordDescription and RecordVariables look correct. I usually go to the raw data pages in SSDS and bring up the last few packets from the device just to verify that the number of columns and bufferSeparator look about right. Check any changes to the XML back into CVS. Copy the XML to the \\Tornado\ssdsdata\mooring(m1|m2)\YYYY\xml directory Go to the \\Tornado\ssdsdata\mooring(m1|m2)\YYYY\cfg directory. This next step is the one that needs to be timed with the mooring turn. When the old instrument is shutdown: Open the ssds.cfg file in a text editor Find the line that shows the currently deployed instrument and copy it to a line just below it. For example, if we are replacing the GPS, it might look like this before: Before Copy
           instrument = PCO2,1471,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1471.xml
           instrument = Metsys,1480,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1480.xml
           instrument = GPS_TYPE3,1416,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1416.xml,,,TransformGPS
           instrument = Spec_PRR,1420,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1420.xml
           instrument = ADCP,1417,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1417.xml
       and this after: After Copy
           instrument = PCO2,1471,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1471.xml
           instrument = Metsys,1480,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1480.xml
           instrument = GPS_TYPE3,1416,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1416.xml,,,TransformGPS
           instrument = GPS_TYPE3,1416,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1416.xml,,,TransformGPS
           instrument = Spec_PRR,1420,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1420.xml
           instrument = ADCP,1417,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1417.xml
15. Now change the new line to have the correct device ID and the correct XML file URL After Device ID update
        instrument = PCO2,1471,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1471.xml
        instrument = Metsys,1480,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1480.xml
        instrument = GPS_TYPE3,1416,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1416.xml,,,TransformGPS
        instrument = GPS_TYPE3,1511,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1511.xml,,,TransformGPS
        instrument = Spec_PRR,1420,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1420.xml
        instrument = ADCP,1417,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1417.xml
16. To clean up the previous deployment information, put start and end dates after the XML URL After Adding Start/End dates
        instrument = PCO2,1471,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1471.xml
        instrument = Metsys,1480,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1480.xml
        instrument = GPS_TYPE3,1416,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1416.xml,2007/04/25 16:21:58,2007/08/01 10:00:00,TransformGPS
        instrument = GPS_TYPE3,1511,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1511.xml,,,TransformGPS
        instrument = Spec_PRR,1420,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1420.xml
        instrument = ADCP,1417,http://dods.mbari.org/data/ssdsdata/mooring/m2/2007/xml/1417.xml
17. (Be careful on the format for the start and end date strings. Leading 0s are required.) Save the cfg file.
    | Saving the file will make the change take hold When the ssds.cfg file changes (saved) is when the OASIS2SSDS processing will pick up the instrument change. Now, the next time it runs it will pick up the instrument change, grab the XML file from the 'xml' directory and publish it to SSDS. It will then publish all data under the new device ID.
2. 6. Edit the metadata in SSDS to put a close date on the old instrument deployment in SSDS. Currently I do that using Enterprise Manager. ##### If this is being done after the fact the next steps will also need to be taken. After the new deployment shows up in SSDS (which can take up to 5 minutes after the OASIS2SSDS has completed), the start time for the new deployment will need to be edited to match the actual time the instrument was swapped. Also because the data was being published under the incorrect device ID, it will need to be moved from one database table in SSDS_Data on Solstice to another table. The first thing that I do is grab the timestamp from the last packet sent from the old device in the raw data page on SSDS. For example, I go to: http://new-ssds.mbari.org:8080/ssds/siamRawDataStep1.jsp and enter the old device ID and set the number of packets back to make sure it goes far enough back to cover the actual time of the instrument swap. Then click on 'Next->'. Once the raw data shows up, find the last packet from the old device and grab the 'SIAM Timestamp' value (not the date/time) as that will be used in the Enterprise Manager query. Open Enterprise Manager and navigate to the 'SSDS_Data' database on Solstice. Browse the tables and find the table with the device ID of the old device and right click on it and select 'Open Table->Return all rows'. Click on the 'SQL' button in Enterprise Manager to bring up the SQL pane. It should show the basic query which should look something like this:
          SELECT     *
          FROM         [1416]
   7. Now add the where clause to pick only the data that is after the timestamp you grabbed from the last packet on the web page.
      | Timestamps in SQL are in Seconds A quick note here, the 'SIAM Timestamp' on the raw data page is actually in milliseconds and the database column is in seconds so you will have to remove the last three digits of the 'SIAM Timestamp' before putting it in this query.
          SELECT     *
          FROM         [1416]
          WHERE timestampSeconds > 1185963023
   9. Run this query by clicking the run button '!' in Enterprise Manager. Look over the results to make sure they look about right (usually you are looking for the length of the return which should be much shorter). You can actually use a count query to see how many rows this query will return. A count query would look like:
          SELECT    count(*)
          FROM         [1416]
          WHERE timestampSeconds > 1185963023
   11. 17. Once you know the query is correct (also compare sequence number in query return and the raw data page), copy it to the clipboard and close the query window in Enterprise Manager. Navigate to the table of the device you want to copy the data into and right click and select 'All Tasks->Import Data...' which will fire up the DTS wizard. Click on 'Next>' For the Data Source database choose Solstice Select the 'SSDS_Data' database (note you should have permissions to do all this and use your windows authentication) Click on 'Next>' The destination configuration should be already to go (Solistice and SSDS_Data database). Click on 'Next>' Select 'Use a query to specify the data to transfer' Click on 'Next>' Paste the query from your clipboard into the 'Query Statement' window (You can click on 'Parse' if you want a quick sanity check) Click on 'Next>' Click on the 'Results' entry under the 'Destination' column which will enable a drop down box. Choose the table of the newly installed device where you will be copying the data to. Click on 'Next>' Click on 'Next>' Click on 'Finish' which will copy the data. Once that is done, open the table of the old instrument and the SQL pane so that we can construct the delete query on the old data. Paste in the select query and verify it is the same data you copied over:
               SELECT     *
               FROM         [1416]
               WHERE timestampSeconds > 1185963023
If it looks good, click on the 'Change Query type ...' button in Enterprise Manager and select 'Delete'. This will change the query to a delete query. Run the query by click on the run '!' button. That will remove all the data from the old instrument. That's it ... whew! Kevin Gomes (August 3, 2007)

Document generated by Confluence on Feb 04, 2026 08:56