Year: 2010

How to convert a csv file to netCDF with 7 lines of python code

When preparing files for the ncDataReader2 I often have to convert text files that contain values separated by TABs or commas. In most simple cases this can be done with some lines of python code. An example is here: import sys, pupynere ll = [l.strip().split(‘,’) for l in open(sys.argv[1]) if not l.startswith(‘#’)] vv = zip(*[map(float,…


ncDataReader2 | 2.2.4

A new release 2.2.4 of ncDataReader2 is out. Some bugs were fixed and the API has slightly changed. This version should work both with Dymola and OpenModelica on Linux and Windows. When you have a DAP-enabled netcdf library  it will even fetch data from the web in background. I already did some Dymola simulations with…


Polygon | reading and writing gpc files

A user pointed me to a problem when reading and writing gpc files. GPC understands two kinds of files, with or without hole-flags. Polygon supports both formats, but this was not yet documented. When using the Polygon() constructor with a filename or the read() or write() methods you may specify an optional  second boolean argument….


ncDataReader2 | 2.2.1

A new minor release of ncDataReader2 is coming. It only fixes one important bug: Numerical  attributes (like scale_factor and add_offset) were not read correctly with 2.2.0. Source and binary packages will follow soon.


Accessing external data from Modelica with ncDataReader2

This example demonstrates the use of the library ncDataReader2 to access data sets from Modelica in a way suitable for the simulation system. The access is handled via external functions from Modelica which read and interpolate the data stored in netCDF files. Dymola is used as the simulation system here. As ncDataReader2 is a simple,…


Making Windows work – free software essentials

Although working mostly with linux  I need to install or to use a MS Windows machine from time to time. Being spoiled by the large amount of software available for linux I really miss a lot of functionality on a “naked” windows computer. After the installation and update process of windows I usually install a…


Smooth transition between functions with tanh()

The problem to get a smooth transition between two curves appears very often. I had this problem a lot when working with simulations of DAE systems where some parameters were defined by empiric functions that did not fit well at the intersection point. An approach that is very easy to implement is the use of…


WP Theme changed

Same content, other appearance! The wordpress theme JS O3 lite didn’t work anymore, maybe because of some plugin updates. I don’t have much time to fix it or search a new, so I choosed the journalist theme that looks simple and nice. It’s a little bit technical and not as elegant as the old theme,…