{"action":"closed","issue":{"url":"https://api.github.com/repos/dankelley/oce/issues/567","labels_url":"https://api.github.com/repos/dankelley/oce/issues/567/labels{/name}","comments_url":"https://api.github.com/repos/dankelley/oce/issues/567/comments","events_url":"https://api.github.com/repos/dankelley/oce/issues/567/events","html_url":"https://github.com/dankelley/oce/issues/567","id":54924444,"number":567,"title":"Error in reading \"raw\" VMDAS file","user":{"login":"richardsc","id":233584,"avatar_url":"https://avatars.githubusercontent.com/u/233584?v=3","gravatar_id":"","url":"https://api.github.com/users/richardsc","html_url":"https://github.com/richardsc","followers_url":"https://api.github.com/users/richardsc/followers","following_url":"https://api.github.com/users/richardsc/following{/other_user}","gists_url":"https://api.github.com/users/richardsc/gists{/gist_id}","starred_url":"https://api.github.com/users/richardsc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardsc/subscriptions","organizations_url":"https://api.github.com/users/richardsc/orgs","repos_url":"https://api.github.com/users/richardsc/repos","events_url":"https://api.github.com/users/richardsc/events{/privacy}","received_events_url":"https://api.github.com/users/richardsc/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dankelley/oce/labels/adp","name":"adp","color":"eb6420"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-01-20T19:03:48Z","updated_at":"2015-01-23T20:30:20Z","closed_at":"2015-01-23T20:30:20Z","body":"# Issue: Error in reading \"raw\" VMDAS file\r\n\r\nFirst, some context. The standard output of VMDAS is a series of binary data files that store:\r\n\r\n1. The raw output from the ADCP (`.ENR`)\r\n\r\n2. The output from the navigation systems (gps, etc) merged with the raw ADCP data (`.ENS`)\r\n\r\n3. Transformed ADCP data (`.ENX`), and\r\n\r\n4. Transformed and averaged ADCP data (`.STA` and `.LTA`) -- i.e. \"short-term\" and \"long-term\" averages\r\n\r\nThe \"raw\" ADCP file, designated by the `.ENR` extension, contains only the raw data output from the ADCP: beam velocities, backscatter, compass and tilt sensor (if available), etc.\r\n\r\nThe \"merged\" nav/ADCP file, designated by the `.ENS` contains the same ADCP data as the `.ENR` file, but with outputs from the (external) navigation sensors merged into the file (i.e. interpolated to the same times as the actual ADCP pings). This data includes often includes `latitude` and `longitude`, and may include `heading` if an external compass was configured and used.\r\n\r\n## Support for raw VMDAS files in oce\r\n\r\nThe current version of oce supports reading VMDAS-formatted files, but currently does not work on the \"raw\" `.ENR` files, due to an error trying to read the `slatitude` and `slongitude` fields. See below for an example:\r\n\r\n\r\n```r\r\nlibrary(oce)\r\nd <- read.adp.rdi('ADCP061_000000.ENR')\r\n```\r\n\r\n```\r\n## Error: object 'slatitude' not found\r\n```\r\n\r\nNote the error `object 'slatitude' not found`, because of course the `.ENR` file has no latitude or longitude, unlike the `.ENS` file:\r\n\r\n\r\n```r\r\nd <- read.adp.rdi('ADCP061_000000.ENS')\r\n```\r\n\r\n```\r\n## read.adp.rdi(): subtracted a headingBias of  -45  degrees\r\n```\r\nwhich loads without issue. And for sanity, let's make sure the location data are reasonable:\r\n\r\n```r\r\nplot(d[['slongitude']], d[['slatitude']])\r\ngrid()\r\n```\r\n\r\n![positionplot](https://cloud.githubusercontent.com/assets/233584/5823706/091c4624-a0ad-11e4-96c2-a403073b8779.png)\r\n\r\nLooks good.\r\n\r\nSo what's the solution? There must be some way to recognize whether the nav data exist, as the current version of Rich Pawlowicz's `rdradcp.m` can read both the `.ENR` and `.ENS` files without issue. A search through `rdradcp.m` for \"vmdas\" doesn't turn up anything obvious, but my understanding of the byte-level parsing of the RDI binaries (and the code in `read.adp.rdi()`) is limited, so I'm tossing this out to @dankelley to investigate further.\r\n"}}