Skip to content

Commit 9b4e1fc

Browse files
committed
release notes
svn path=/autoplot/trunk/QDataSet/; revision=16501
1 parent 4c71767 commit 9b4e1fc

2 files changed

Lines changed: 29 additions & 6 deletions

File tree

‎QDataSet/src/org/virbo/dataset/examples/Schemes.java‎

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/*
2-
* To change this license header, choose License Headers in Project Properties.
3-
* To change this template file, choose Tools | Templates
4-
* and open the template in the editor.
5-
*/
1+
62
package org.virbo.dataset.examples;
73

84
import java.text.ParseException;
@@ -11,7 +7,6 @@
117
import org.das2.datum.EnumerationUnits;
128
import org.das2.datum.Units;
139
import org.das2.datum.UnitsUtil;
14-
import org.das2.util.filesystem.ExpensiveOpCache;
1510
import org.virbo.dataset.ArrayDataSet;
1611
import org.virbo.dataset.DataSetUtil;
1712
import org.virbo.dataset.JoinDataSet;
@@ -35,6 +30,8 @@
3530
*/
3631
public class Schemes {
3732

33+
private static Logger logger= Logger.getLogger("qdataset.schemes");
34+
3835
/**
3936
* return a bounding box for the data. This is a rank 2 dataset where
4037
* ds[0,:] shows the bounds for the first dimension and ds[1,:] shows the
@@ -152,6 +149,30 @@ public static boolean isSimpleSpectrogram( QDataSet ds ) {
152149
return ds.rank()==2;
153150
}
154151

152+
/**
153+
* return a rank 1 scalar time series.
154+
* @return a rank 1 scalar time series.
155+
*/
156+
public static QDataSet scalarTimeSeries() {
157+
try {
158+
QDataSet density= Ops.add( Ops.ripples(20), Ops.randomn(0,20) );
159+
density= Ops.putProperty( density, QDataSet.UNITS, Units.pcm3 );
160+
QDataSet t = Ops.timegen("2011-10-24", "20 sec", 20 );
161+
return Ops.link( t, density );
162+
} catch (ParseException ex) {
163+
throw new RuntimeException(ex);
164+
}
165+
}
166+
167+
/**
168+
* return true if the data is a simple spectrogram.
169+
* @param ds a dataset
170+
* @return true if the data is a simple spectrogram.
171+
*/
172+
public static boolean isScalarTimeSeries( QDataSet ds ) {
173+
return ds.rank()==1 && isTimeSeries(ds);
174+
}
175+
155176
/**
156177
* return a rank 2 simple spectrogram, which has two indeces
157178
* and is a TimeSeries.

‎QDataSet/src/test/SchemesDemo.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ private static void test1() {
1313
if ( ! Schemes.isTrajectory( Schemes.trajectory() ) ) throw new IllegalArgumentException();
1414
if ( ! Schemes.isRank1AlongTrajectory( Schemes.rank1AlongTrajectory() ) ) throw new IllegalArgumentException();
1515
if ( ! Schemes.isAngleDistribution( Schemes.angleDistribution() ) ) throw new IllegalArgumentException();
16+
if ( ! Schemes.isScalarTimeSeries( Schemes.scalarTimeSeries() ) ) throw new IllegalArgumentException();
17+
if ( ! Schemes.isSimpleSpectrogramTimeSeries( Schemes.simpleSpectrogramTimeSeries() ) ) throw new IllegalArgumentException();
1618
}
1719

1820
public static void main( String[] args ) {

0 commit comments

Comments
 (0)