Extract average Solar wind speed from ACE data
Created: 2012-10-30 11:42:20
It reads the data coming from a MDES (HELIO) query and calculates the average Solar Wind speed. Notice that it just works for ACE as other missions could have the columns in different order.
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (1)
Gabriele Pierantoni
Eoin Carley |
Titles (1)
Extract average Solar wind speed from ACE data |
Descriptions (1)
It reads the data coming from a MDES (HELIO) query and calculates the average Solar Wind speed. Notice that it just works for ACE as other missions could have the columns in different order. |
Dependencies (0)
Processors (2)
Name |
Type |
Description |
Read_Text_File |
localworker |
ScriptBufferedReader getReader (String fileUrl, String encoding) throws IOException {
InputStreamReader reader;
try {
if (encoding == null) {
reader = new FileReader(fileUrl);
} else {
reader = new InputStreamReader(new FileInputStream(fileUrl),encoding);
}
}
catch (FileNotFoundException e) {
// try a real URL instead
URL url = new URL(fileUrl);
if (encoding == null) {
reader = new InputStreamReader (url.openStream());
} else {
reader = new InputStreamReader (url.openStream(), encoding);
}
}
return new BufferedReader(reader);
}
StringBuffer sb = new StringBuffer(4000);
if (encoding == void) {
encoding = null;
}
BufferedReader in = getReader(fileurl, encoding);
String str;
String lineEnding = System.getProperty("line.separator");
while ((str = in.readLine()) != null) {
sb.append(str);
sb.append(lineEnding);
}
in.close();
filecontents = sb.toString();
|
Beanshell_AverageSpeed |
beanshell |
ScriptString content = text;
String[] lines = content.split("\\n");
double[] velocities = new double[lines.length-2];
double vel_tot = 0;
double vel_av = 0;
int samplesNumber = 0;
for(int n = 2; n < lines.length; n++)
{
String[] values = lines[n].split("\\s+");
System.out.println("Velocity [" + n + "] : " + values[1]);
if(!Double.valueOf(values[1]).isNaN())
{
velocities[samplesNumber] = Double.valueOf(values[1]);
vel_tot += Double.valueOf(values[1]);
samplesNumber++;
}
}
vel_av = vel_tot/samplesNumber;
debug=content; |
Beanshells (1)
Name |
Description |
Inputs |
Outputs |
Beanshell_AverageSpeed |
|
text
|
debug
vel_av
|
Outputs (1)
Name |
Description |
average_sw_vel |
|
Datalinks (3)
Source |
Sink |
url |
Read_Text_File:fileurl |
Read_Text_File:filecontents |
Beanshell_AverageSpeed:text |
Beanshell_AverageSpeed:vel_av |
average_sw_vel |
Uploader
License
All versions of this Workflow are
licensed under:
Version 1
(of 1)
Credits (1)
(People/Groups)
Attributions (0)
(Workflows/Files)
None
Shared with Groups (0)
None
Featured In Packs (0)
None
Log in to add to one of your Packs
Attributed By (1)
(Workflows/Files)
Favourited By (0)
No one
Statistics
Other workflows that use similar services
(0)
There are no workflows in myExperiment that use similar services to this Workflow.
Comments (0)
No comments yet
Log in to make a comment