package org.autoplot.jythonsupport;
import java.text.ParseException;
import java.util.List;
import java.util.logging.Level;
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
* Tp,Np=getDataSets( ['vap+cdaweb:ds=STA_L2_MAGPLASMA_1M&id=Tp','vap+cdaweb:ds=STA_L2_MAGPLASMA_1M&id=Np'],'2022-12-24' )
*}
* @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"
+ " |
sortTime=True | sort the data by its timetags |
\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",
"sortTime"
},
new PyObject[] {
Py.None, 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