Skip to content

Instantly share code, notes, and snippets.

@dstuebe
dstuebe / TestProcess.java
Created July 24, 2013 01:40
Running OpenMPI process from Java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Map;
import java.util.Map.Entry;
import javax.swing.text.html.HTMLDocument.Iterator;
@dstuebe
dstuebe / TestProcess.java
Last active December 20, 2015 03:39
Demo python program that writes stuff to a stream handler and a file handler. Hoping to show failure when executed using Java ProcessBuilder with output piped to Java buffer. Very strange behavior - the python process just hangs as though it is waiting on the stream when run on windows.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class TestProcess {
@dstuebe
dstuebe / create_test_nc_file.py
Last active December 19, 2015 16:49
Pretty crazy test file for netCDF
from netCDF4 import Dataset
import numpy
rootgrp = Dataset('test.nc','w')
### Create some groups
group1 = rootgrp.createGroup('g1')
group2 = rootgrp.createGroup('g2')
@dstuebe
dstuebe / H5Zszip.c_excerpt
Last active December 19, 2015 06:39
Example fortran code to create compressed dataset with compound data types.
/*-------------------------------------------------------------------------
* Function: H5Z_can_apply_szip
*
* Purpose: Check the parameters for szip compression for validity and
* whether they fit a particular dataset.
*
* Note: This function currently range-checks for datatypes with
* 8-bit boundaries (8, 16, 24, etc.). It appears that the szip
* library can actually handle 1-24, 32 & 64 bit samples. If
* this becomes important, we should make the checks below more
@dstuebe
dstuebe / SWE-MultiStation-TimeSeries_QC.xml
Last active December 18, 2015 01:48
SWE Templates with bug fix: Element Count quality removed
<?xml version="1.0" encoding="UTF-8"?>
<!-- This template is an example of a SWE Data Record composed of static and dynamic fields for -->
<!-- multiple stations with multiple sensors including quality elements for some quantities. -->
<!-- -->
<!-- This template is almost identical to the SWE-Multisation-TimeSeries with the addition of some -->
<!-- quality elements. Quality flags for static and dynamic data are included for station1 sensor 1.-->
<!-- An example of NilValue is also provided for wind speed in station 1 sensor 1 -->
<!-- -->
<!-- Most any element may be static or dynamic, but the static fields must be encoded inline, while -->
<!-- The dyamic elements must be block encoded in the data array. -->
@dstuebe
dstuebe / components.xml
Created May 12, 2013 00:32
components of DescribeSensor-Network
<sml:components>
<sml:ComponentList>
<sml:component name='wmo_41001'>
<sml:System>
<!-- Include name & description only if they have some useful human readable purpose -->
<!-- ==================================================================== -->
<!-- PLATFORM IDENTIFIERS -->
<!-- Gives ability to platforms by name -->
<!-- ==================================================================== -->
@dstuebe
dstuebe / OM-Get-Observation.xml
Last active December 16, 2015 22:09
SOS responses
<?xml version="1.0" encoding="UTF-8"?>
<!-- Template Document for a generic (independant of feature type) Get Observation. -->
<!-- Specific feature types are referenced for example only. -->
<!-- -->
<!-- The GO contains one member observation per feature type in the response. -->
<!-- The result block in the template is empty. Examples of the result block are in the SWE -->
<!-- templates defined seperately for each strucutre and concept. Any of these SWE results could -->
<!-- be expressed in the result block of this document with the appropriate matching metadata. -->
<!-- -->
<om:ObservationCollection
@dstuebe
dstuebe / timeSeriesProfile.xml
Last active December 16, 2015 20:00
Draft candidate for time series profile data
<?xml version="1.0" encoding="UTF-8"?>
<!-- This template is an example of a SWE Data Record composed of static and dynamic fields for -->
<!-- multiple stations with multiple profiling sensors -->
<!-- -->
<!-- Most any element may be static or dynamic, but the static fields must be encoded inline, while -->
<!-- The dyamic elements must be block encoded in the data array. -->
<!-- -->
<!-- Description of data -->
<!-- SWE DataRecord containing 1 Station: -->
<!-- Station 1 has 2 sensors -->
@dstuebe
dstuebe / time_series_profile_alt1.xml
Last active December 16, 2015 19:10
Array based time series profile. I really struggle with the DataChoice based profile encoding. The separation of static and dynamic data in the new structure makes the array based method much more attractive to me. It is close to the intent of the SWE spec for multidimensional arrays, but making use of our separation & conventions to avoid repea…
<?xml version="1.0" encoding="UTF-8"?>
<!-- This template is an example of a SWE Data Record composed of static and dynamic fields for -->
<!-- multiple stations with multiple profiling sensors -->
<!-- -->
<!-- Most any element may be static or dynamic, but the static fields must be encoded inline, while -->
<!-- The dyamic elements must be block encoded in the data array. -->
<!-- -->
<!-- Description of data -->
<!-- SWE DataRecord containing 1 Station: -->
<!-- Station 1 has 2 sensors -->
@dstuebe
dstuebe / results.txt
Created March 12, 2013 19:30
Coroutine examples and timing
For n= 100000
$ python test_coroutines.py
Coroutine Loop Result: '14.1121757499'; loop time (ms): 393.39017868
Numpy Loop Result: '14.1121757499'; loop time (ms): 26105.5378914
Numpy Dot Result: '14.1121757499'; dot time (ms): 0.148057937622
# can't pass a scalar by reference, try passing an array of size 1
Coroutine Loop No Result: '[ 14.11217575]'; loop time (ms): 438.895225525