Sign inSign up

noterik/stageplayer-sbf-reader

By noterik

•Updated over 5 years ago

SBF File reader for Java Application Server

Image
0

1M+

noterik/stageplayer-sbf-reader repository overview

⁠SBFReader

Reads out 32/64 bits SBFs. Should be build into a war deployed as a java server application. Creates a resource under:

/stageplayer-sbf-reader

Provides a JSON api through HTTP.

⁠Configuration

Should be placed in /opt/noterik/sbfreader.properties (check src/env.properties), example can be seen in sbfreader.example.properties:

data_root="/export/data"

⁠Querying SBF Metadata

Gives back a listing of all streams in a SBF along with their name, measurement unit and minimal/maximum values. Can be used by sending a POST HTTP request to

/stageplayer-sbf-reader

with a JSON body of the following shape:

{
	"getMeta": {
		"sbfs": [
			"/stage/DWB27321_300_0105001_039_001_200_17-03-2017_23-07-12_dat.sbf"
		]
	}	
}

Responds with a JSON object of following shape:

{
    "metadata": [
        {
            "path": "/stage/DWB27321_300_0105001_039_001_200_17-03-2017_23-07-12_dat.sbf",
            "frequency": 40.01232105638765,
            "bits": 32,
            "streams": [
                {
                    "name": "TIMESIGNAL",
                    "unit": "s",
                    "min": 0.000528500007931143,
                    "max": 523.8391723632812
                },
                {
                    "name": "WAVE.F2",
                    "unit": "m",
                    "min": -6.818584442138672,
                    "max": 18.48550033569336
                },
                {
                    "name": "WAVE.F1",
                    "unit": "m",
                    "min": -11.567220687866211,
                    "max": 15.656943321228027
                },
                {
                    "name": "TIME_SEC",
                    "unit": "s",
                    "min": 0,
                    "max": 520
                },
                {
                    "name": "TIME_FRAC",
                    "unit": "s",
                    "min": 0.00004099999932805076,
                    "max": 4.999769687652588
                },
                ...Rest of streams
            ]
        }
    ]
}

⁠Querying SBF stream data

Gives back an array of data for given sbfs. Takes a HTTP POST request of the following shape:

{
	"getData": {
		"sbf":"/stage/DWB27321_300_0105001_039_001_200_17-03-2017_23-07-12_dat.sbf",
		"start": -1000, //Start of data
		"end": 2000, //End of data
		"resolution": 400, //Amount of points to retrieve
		"streams": [
			"WAVE.F1",
			"WAVE.F2"
		]
	}
}

Responds with JSON of following shape:

[
    {
        "sbf": "/stage/DWB27321_300_0105001_039_001_200_17-03-2017_23-07-12_dat.sbf",
        "data": [
            {
                "name": "WAVE.F1",
                "streams": [
                    [
                        -1000,
                        null
                    ],
                    [
                        0.528500007931143,
                        0.044260941445827484
                    ],
                    [
                        25.522001087665558,
                        0.04493056610226631
                    ],
                    ...Rest of stream data
                ]
            },
            {
                "name": "WAVE.F2",
                "streams": [
                    [
                        -1000,
                        null
                    ],
                    [
                        0.528500007931143,
                        -0.04436685889959335
                    ],
                    [
                        25.522001087665558,
                        -0.04274933785200119
                    ],
                	...Rest of stream data! 
                ]
            }
        ]
    }
]

⁠Combining JSON commands

Multiple actions can be done at the same time. You can combine actions by sending a HTTP Post request with a body containing a JSON array with the actions like this:

[
	{
		"getMeta": { //First action
			"sbfs": [
				"/stage/DWB27321_300_0105001_039_001_2401_17-03-2017_23-07-12_dat.sbf"
			]
		}	
	},
	{
		"getData": { //Second action
			"sbf":"/stage/DWB27321_300_0105001_039_001_200_17-03-2017_23-07-12_dat.sbf",
			"start": -1000,
			"end": 2000,
			"resolution": 400,
			"streams": [
				"WAVE.F1",
				"WAVE.F2"
			]
		}
	}
]

Will send a response containing a JSON body like:

[
	{... Results of command 1},
	{....Results of command 2}
]

Tag summary

Content type

Image

Digest

Size

200.8 MB

Last updated

over 5 years ago

docker pull noterik/stageplayer-sbf-reader