package org.autoplot.jythonsupport;
import java.text.ParseException;
import java.util.List;
import java.util.logging.Logger;
import org.das2.datum.DatumRange;
import org.das2.datum.DatumRangeUtil;
import org.python.core.Py;
import org.python.core.PyObject;
import org.python.core.PyString;
import org.das2.qds.QDataSet;
import org.das2.datum.Units;
import org.das2.qds.ops.Ops;
import org.das2.util.monitor.ProgressMonitor;
import org.python.core.PyList;
/**
* new implementation of the dataset command allows for keywords in the
* Jython environment.
*
{@code
* dataset( [1,2,3,4,3], title='My Data' )
*}
* @see http://autoplot.org/help.datasetCommand
* @author jbf
*/
public class GetDataSetsCommand extends PyObject {
private static final Logger logger= org.das2.util.LoggerManager.getLogger("jython.commands.getdataset");
public static final PyString __doc__ =
new PyString("getDataSets(list,timerange,monitor,[named parameters])
"
+ " load the data specified by URI into Autoplot's internal data model. This will\n"
+ " block until the load is complete, and a ProgressMonitor object can be used to\n"
+ " monitor the load..\n"
+ "
optional parameters:\n"
+ "\n"
+ "timerange | String or DatumRange |
\n"
+ "monitor | Progress Monitor |
\n"
+ "
\n"
+ "
named parameters:\n"
+ "\n"
+ "trim=True | trim the data to the requested time range. |
\n"
+ "units=None | convert the data to the given units, or remove the unit if empty string or None\n"
+ " |
");
private List toList( Object arg ) {
return (List)arg;
}
/**
* implement the python call.
* @param args the "rightmost" elements are the keyword values.
* @param keywords the names for the keywords.
* @return Py.None
*/
@Override
public PyObject __call__(PyObject[] args, String[] keywords) {
FunctionSupport fs= new FunctionSupport( "getDataSets",
new String[] { "uri",
"timerange", "monitor",
"trim", "units"
},
new PyObject[] {
Py.None, Py.None,
Py.None, Py.None
}
);
fs.args( args, keywords );
int nparm= args.length - keywords.length;
List uris=null;
Units units= null;
DatumRange trimRange= null;
ProgressMonitor monitor= null;
List result=null;
for ( int i=nparm; i