Scholarship in Sweden

I spent one month from mid-January to mid-February 2013 at the University of Kalmar (Sweden) to learn the theory of quantitative reconstruction of past vegetation. It consisted in courses and practical work to get used to the models developed by Shinya Sugita (including the models REVEAL and LOVE, as well as the Landscape Reconstruction Algorithm). This was the opportunity to apply these models to my data and represent so far the first attempt in the Alps.

Continue reading →
Posted by Benjamin in Lab Notes, 0 comments

Make a so-called csv a real csv

When you create csv files from the same systems than those which are not able to properly open them, you might need afterward to clean it up. I often find myself annoyed by so-called csv files that are actually delimited by semicolons, and commas are used as decimal separators. Here is a code to first replace commas by periods, then replace semicolons by commas.

tell application "Finder" to set FileToEdit to selection as string
set AccessToFile to open for access file FileToEdit with write permission
set CSVContent to read file FileToEdit
to switchText from t to r instead of s
set d to text item delimiters
set text item delimiters to s
set t to t's text items
set text item delimiters to r
tell t to set t to item 1 & ({""} & rest)
set text item delimiters to d
t
end switchText
switchText from CSVContent to "." instead of ","
set FirstStepText to result
switchText from FirstStepText to "," instead of ";"
set TextToWrite to result
set eof of file FileToEdit to 0
write TextToWrite to AccessToFile
close access AccessToFile

Credit goes to member kai (http://macscripter.net/viewtopic.php?pid=41243#p41243).

Posted by Benjamin in Software, 0 comments

Excel – Plain text to tab-delimited

Excel on non-English systems can suffer a bad limitation, namely it’s inability to properly interpret the csv format (comma separated value). Here is a tiny AppleScript code to fix this problem. It parses plain text from the first column of any csv opened in Excel into a tab-delimited layout, likely to be saved as a native Excel file.

tell application "Microsoft Excel"
    text to columns (range "A:A" of active sheet of active workbook) with comma
end tell
Posted by Benjamin in Software, 0 comments