Convert table to CDS format
Created: 2012-05-28 12:04:36
Last updated: 2012-05-28 12:15:24
It converts a csv file (comma separated values) to the CDS format. It also provides relevant information to create the ReadMe file.
The first row in the input file must be the column names.
If you want to run this workflow, you have to install astrotaverna plugin. You can easyly cusomize the workflow to provide a votable or fits table as input.
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (0)
Titles (0)
Descriptions (0)
Dependencies (0)
Inputs (1)
Name |
Description |
nameCSV_File |
|
Processors (6)
Name |
Type |
Description |
Format_conversion |
tpipe |
|
formatTableIn_value |
stringconstant |
Valuecsv |
formatTableOut_value |
stringconstant |
Valueascii |
Extract_CDS_Information |
beanshell |
ScriptBufferedReader bf = new BufferedReader(new FileReader(fileName));
int status;
result = "";
final int INSIDE_NUMBER = 0, WAITING_FIRST_NUMBER = 1, WAITING_DIGIT = 2, INSIDE_STRING = 3;
int i = 0;
String line;
int columnsNumber = 0;
String [] header = null;
int [] init = null;
int [] end = null;
while ((line = bf.readLine())!=null) {
if(i==0){
/*header*/
line = line.replaceFirst("#", "").replaceAll("\t", " ").trim().replaceAll(" +", " ");
header = line.split(" ");
columnsNumber = header.length;
init = new int[columnsNumber];
end = new int[columnsNumber];
//for (String cad: header){
// System.out.println("-"+cad+"-");
//}
}else{
if(i==1){
/*data*/
int colIndex = 0;
init[colIndex]=1;
if(line.charAt(0)==' ')
status = WAITING_FIRST_NUMBER;
else
status = INSIDE_NUMBER;
for(int j = 0; j end[columnsNumber-1]){
System.out.println("Adjust last column size from "+ end[columnsNumber-1] + " to "+ line.length());
end[columnsNumber-1] = line.length();
}
}
}
i++;
}
result = "Number of records: " + (i-1) + System.getProperty("line.separator");
result = result + "Columns Information: " + System.getProperty("line.separator");
for(int k = 0; k |
Remove_Marks |
beanshell |
ScriptBufferedReader bf = new BufferedReader(new FileReader(fileName));
int status;
result = "";
final int INSIDE_NUMBER = 0, WAITING_FIRST_NUMBER = 1, WAITING_DIGIT = 2, INSIDE_STRING = 3;
int i = 0;
String line;
int columnsNumber = 0;
String [] header = null;
int [] init = null;
int [] end = null;
while ((line = bf.readLine())!=null) {
line = line.replace("\"\"", " ");
result += line + System.getProperty("line.separator");
i++;
} |
New_Tmp_File |
beanshell |
Script
File file = File.createTempFile("astro_cds", null);
filePath = file.getAbsolutePath(); |
Beanshells (3)
Name |
Description |
Inputs |
Outputs |
Extract_CDS_Information |
|
fileName
|
result
|
Remove_Marks |
|
fileName
|
result
|
New_Tmp_File |
|
|
filePath
|
Outputs (2)
Name |
Description |
CDSTable |
|
CDS_info |
|
Datalinks (8)
Source |
Sink |
formatTableIn_value:value |
Format_conversion:formatTableIn |
formatTableOut_value:value |
Format_conversion:formatTableOut |
New_Tmp_File:filePath |
Format_conversion:outputFileNameIn |
nameCSV_File |
Format_conversion:voTable |
Format_conversion:outputTable |
Extract_CDS_Information:fileName |
Format_conversion:outputTable |
Remove_Marks:fileName |
Remove_Marks:result |
CDSTable |
Extract_CDS_Information:result |
CDS_info |
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 (0)
(Workflows/Files)
None
Favourited By (1)
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