Skip to content

A package that contains classes to work wih XBT bin files generated by Amverseas

License

LGPL-3.0, Unknown licenses found

Licenses found

LGPL-3.0
LICENSE
Unknown
license.txt
Notifications You must be signed in to change notification settings

NOAA-AOML/amverseasbinfileutils

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

amverseasbinfileutils

A Java library that contains classes to work wih XBT bin files generated by Amverseas
The libray can encode and decode message types 1, 2, 3 and 4.
A type 4 message is essentially a type 3 message that stores resistace values instead of temperature values.
Storing actual raw data instead of the temperature values is useful for converting data between the different fall rate equations and applying resistance offsets when calibrating hardware configurations.
Type 4 messages are intended to be used during the calibration stage of a setup.

Disclaimer

This repository is a scientific product and is not official communication of the National Oceanic and Atmospheric Administration, or the United States Department of Commerce. All NOAA GitHub project code is provided on an ‘as is’ basis and the user assumes responsibility for its use. Any claims against the Department of Commerce or Department of Commerce bureaus stemming from the use of this GitHub project will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by the Department of Commerce. The Department of Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by DOC or the United States Government.


COMPILING AND USING THE LIBRARY

To compile, make sure that a java sdk version of at least 1.7 is installed
and that the jar archive tool is installed.

You can check by typing

javac -version

you should see something like

javac 1.7.0_65

Type "jar" and your screen should scroll with many jar options.


-Compile library-

If using Windows run makeit.bat. If using linux/unix run makeit.sh .
In linux/unix you will have to make makeit.sh executable.
To make it executable type

chmod +x makeit.sh

When done compiling, AmverseasBinFileUtils.jar will be placed in the lib directory.


-Example programs-

Some example programs are included to get an idea of how to use the library.

  • DecoderTest
  • DecoderTestASCII
  • DecoderTestGetDepths
  • DecodeEncodeXBTProfile
  • EditBinFile

DecoderTest
Takes an XBT profile as an argument and prints the metadata and data to standard out.
DecoderTestASCII
Takes an XBT profile as an argument and prints the metadata and data to standard out in the AOML ASCII format.
DecoderTestGetDepths
Takes an XBT profile as an argument and prints the depth and temperature points to standard out.
DecoderTestGetDepthsTwoMeterResolution
Takes an XBT profile as an argument and prints linearly interpolated depth and temperature points at two meter resolution to standard out.
DecodeEncodeXBTProfile
Takes an XBT profile and a an output filename as arguments.It then extracts data from the input
XBT profile and encodes it into a new profile. This example basically makes a copy of an XBT profile.
BinConverter
Takes up to three arguments. filename type and salinity. type is an integer, and salinity a double.
EditBinFile
Allows one to edit an XBT profile's meta data on the command line.


-Compile example programs-

You should be able to just copy and paste these commands striaght into a terminal window/command prompt.
Make sure you are in the directory with the example programs and that you have a java JDK installed.

linux/Mac OSX

javac -cp .:lib/AmverseasBinFileUtils.jar:lib/commons-math3-3.6.1.jar DecoderTest.java
javac -cp .:lib/AmverseasBinFileUtils.jar:lib/commons-math3-3.6.1.jar DecoderTestASCII.java
javac -cp .:lib/AmverseasBinFileUtils.jar:lib/commons-math3-3.6.1.jar DecoderTestGetDepths.java
javac -cp .:lib/AmverseasBinFileUtils.jar:lib/commons-math3-3.6.1.jar DecoderTestGetDepthsTwoMeterResolution.java
javac -cp .:lib/AmverseasBinFileUtils.jar:lib/commons-math3-3.6.1.jar DecodeEncodeXBTProfile.java
javac -cp .:lib/AmverseasBinFileUtils.jar:lib/commons-math3-3.6.1.jar BinConverter.java
javac -cp .:lib/AmverseasBinFileUtils.jar:lib/commons-math3-3.6.1.jar:lib/commons-cli-1.4.jar EditBinFile.java

windows

javac -cp .;lib/AmverseasBinFileUtils.jar;lib/commons-math3-3.6.1.jar DecoderTest.java
javac -cp .;lib/AmverseasBinFileUtils.jar;lib/commons-math3-3.6.1.jar DecoderTestASCII.java
javac -cp .;lib/AmverseasBinFileUtils.jar;lib/commons-math3-3.6.1.jar DecoderTestGetDepths.java
javac -cp .;lib/AmverseasBinFileUtils.jar;lib/commons-math3-3.6.1.jar DecoderTestGetDepthsTwoMeterResolution.java
javac -cp .;lib/AmverseasBinFileUtils.jar;lib/commons-math3-3.6.1.jar DecodeEncodeXBTProfile.java
javac -cp .;lib/AmverseasBinFileUtils.jar;lib/commons-math3-3.6.1.jar BinConverter.java
javac -cp .;lib/AmverseasBinFileUtils.jar;lib/commons-math3-3.6.1.jar;lib/commons-cli-1.4.jar EditBinFile.java

-Run example programs-

linux/Mac OSX

java -cp .:lib/AmverseasBinFileUtils.jar:lib/commons-math3-3.6.1.jar DecoderTest profile.bin
java -cp .:lib/AmverseasBinFileUtils.jar:lib/commons-math3-3.6.1.jar DecoderTestASCII profile.bin
java -cp .:lib/AmverseasBinFileUtils.jar:lib/commons-math3-3.6.1.jar DecoderTestGetDepths profile.bin
java -cp .:lib/AmverseasBinFileUtils.jar:lib/commons-math3-3.6.1.jar DecoderTestGetDepthsTwoMeterResolution profile.bin
java -cp .:lib/AmverseasBinFileUtils.jar:lib/commons-math3-3.6.1.jar DecodeEncodeXBTProfile profile.bin copiedProfile.bin
java -cp .:lib/AmverseasBinFileUtils.jar:lib/commons-math3-3.6.1.jar BinConverter profile.bin 0
java -cp .:lib/AmverseasBinFileUtils.jar:lib/commons-math3-3.6.1.jar BinConverter profile.bin 1
java -cp .:lib/AmverseasBinFileUtils.jar:lib/commons-math3-3.6.1.jar BinConverter profile.bin 1 34.5
java -cp .:lib/AmverseasBinFileUtils.jar:lib/commons-math3-3.6.1.jar:lib/commons-cli-1.4.jar EditBinFile -help

windows

java -cp .;lib/AmverseasBinFileUtils.jar;lib/commons-math3-3.6.1.jar DecoderTest profile.bin
java -cp .;lib/AmverseasBinFileUtils.jar;lib/commons-math3-3.6.1.jar DecoderTestASCII profile.bin
java -cp .;lib/AmverseasBinFileUtils.jar;lib/commons-math3-3.6.1.jar DecoderTestGetDepths profile.bin
java -cp .;lib/AmverseasBinFileUtils.jar;lib/commons-math3-3.6.1.jar DecoderTestGetDepthsTwoMeterResolution profile.bin
java -cp .;lib/AmverseasBinFileUtils.jar;lib/commons-math3-3.6.1.jar DecodeEncodeXBTProfile profile.bin copiedProfile.bin
java -cp .;lib/AmverseasBinFileUtils.jar;lib/commons-math3-3.6.1.jar BinConverter profile.bin 0
java -cp .;lib/AmverseasBinFileUtils.jar;lib/commons-math3-3.6.1.jar BinConverter profile.bin 1
java -cp .;lib/AmverseasBinFileUtils.jar;lib/commons-math3-3.6.1.jar BinConverter profile.bin 1 34.5
java -cp .;lib/AmverseasBinFileUtils.jar;lib/commons-math3-3.6.1.jar;lib/commons-cli-1.4.jar EditBinFile -help

Mono Executable

If you need a stand alone executable you could use IKVM to convert the compiled program to a mono program.
In this example we'll convert the EditBinFle program. This was done under linux but the same should be possible under windows.
You'll have to use ikvm in windows to create a windows binary and the EditBinFile.java should be compiled with jdk of no more than 1.7 (Java 7)
Make sure ikvm and the mono runtime engine are installed, then run the following.

ikvmc EditBinFile.class lib/AmverseasBinFileUtils.jar lib/commons-math3-3.6.1.jar lib/commons-cli-1.4.jar

To test the program type the following.

./EditBinFile.exe -help

Check the file type with the file command.

file EditBinFile.exe
EditBinFile.exe: PE32 executable (console) Intel 80386 Mono/.Net assembly, for MS Windows

Plotting the profile in Octave or Matlab

Once compiled, you can read, edit and create an xbt profile with Octave or Matlab by importing
the library. Open Octave or Matlab and navigate to the directory containing all the files.
This should be the directory that has the lib folder.
Here is an exmaple of how to plot temperature vs depth for profile.bin.

javaaddpath([pwd(),'/lib/AmverseasBinFileUtils.jar'])
javaaddpath([pwd(),'/lib/commons-math3-3.6.1.jar'])
BinDecoder=javaObject('binfileutils.BinDecoder','profile.bin');
XBTProfile=javaMethod('getXBTProfile',BinDecoder);
temps=javaMethod('getTemperaturePoints',XBTProfile);
DepthCalculator=javaObject('binfileutils.DepthCalculator',XBTProfile);
depths=javaMethod('getMeasurementDepths',DepthCalculator);
plot(temps,-depths)

Two meter resolution check

You can do some interpolation and produce two meter resolution profiles with Octave or Matlab.
Here is an example of a linear interpolation.

Open Octave or Matlab and navigate to the directory containing profile.bin and do the following

%determine max depth and floor the value
maxDepth=floor(max(depths));
%create matrix of depths starting at 2 and ending at maxDepth with a step of 2
%increasing value every two meters
twoMeterDepths= [2:2:maxDepth];
% get a piece-wise polynomial structure
pp=interp1(depths,temps,'linear','pp');
%evaluate piece-wise polynomial structure
twoMeterTemps=ppval(pp,twoMeterDepths);
%plot one on top of the other
figure;
hold on;
plot(depths,temps,'x');
plot(twoMeterDepths,twoMeterTemps);

About

A package that contains classes to work wih XBT bin files generated by Amverseas

Resources

License

LGPL-3.0, Unknown licenses found

Licenses found

LGPL-3.0
LICENSE
Unknown
license.txt

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 99.1%
  • Other 0.9%