FESOM / pyfesom

python library and tools for pre and post processing of the FESOM ocean model files
http://pyfesom.readthedocs.io/en/latest/index.html
MIT License
11 stars 6 forks source link

Avoid temporary (large) list when reading aux3d.out #9

Closed strawpants closed 4 years ago

strawpants commented 4 years ago

Hi Nikolay, here are two minor changes which you may want to merge.

(1) I had a MemoryError on a relatively light Virtual Machine when using fesom_mesh on a dense grid. I could fix (i.e. reduce memory footprint) it by using numpy.fromiter to fill an ndarray directly from the "aux3d.out" file, and avoiding the allocation of an intermediate list which was input to numpy.array.

(2) A small bug I found in fesom2gdal where I forgot to refer to the variable surftype and wrongly used ogr.wkbTriangle. This is valid code, but in Qgis, geometries of the type ogr.wkbTriangle won't be visible, so I use a plain polygon now to represent the triangular surface elements.

all the best, Roelof

koldunovn commented 4 years ago

Everything that leads to a speedup is very welcomed! :) Thanks a lot for the PR!