|
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 | + |
6 | 2 | package org.virbo.dataset.examples; |
7 | 3 |
|
8 | 4 | import java.text.ParseException; |
|
11 | 7 | import org.das2.datum.EnumerationUnits; |
12 | 8 | import org.das2.datum.Units; |
13 | 9 | import org.das2.datum.UnitsUtil; |
14 | | -import org.das2.util.filesystem.ExpensiveOpCache; |
15 | 10 | import org.virbo.dataset.ArrayDataSet; |
16 | 11 | import org.virbo.dataset.DataSetUtil; |
17 | 12 | import org.virbo.dataset.JoinDataSet; |
|
35 | 30 | */ |
36 | 31 | public class Schemes { |
37 | 32 |
|
| 33 | + private static Logger logger= Logger.getLogger("qdataset.schemes"); |
| 34 | + |
38 | 35 | /** |
39 | 36 | * return a bounding box for the data. This is a rank 2 dataset where |
40 | 37 | * ds[0,:] shows the bounds for the first dimension and ds[1,:] shows the |
@@ -152,6 +149,30 @@ public static boolean isSimpleSpectrogram( QDataSet ds ) { |
152 | 149 | return ds.rank()==2; |
153 | 150 | } |
154 | 151 |
|
| 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 | + |
155 | 176 | /** |
156 | 177 | * return a rank 2 simple spectrogram, which has two indeces |
157 | 178 | * and is a TimeSeries. |
|
0 commit comments