onsdag den 30. marts 2016

Installing python with matplotlib and basemap on mac

In the last couple of months I have installed python on two different macs. It took forever to get matplotlib and basemap to work the first time, before I understood that I could not use the build-in python from apple. I ended up installing python enthought using homebrew, and I promised myself that I would write down how to do it after the second installation. But I forgot. And now it's been a while, I got a new laptop and I have to install python once again.
So here it goes, for my future self and anybody else who can use it.


  • Install Xcode from the app store. It's free and can be found here. Make sure to open Xcode and agree to it's terms and conditions.

  • Download and install the enthought canopy python distribution. This is their free python version, which entails numpy, scipy and matplotlib.
    To finish the canopy installation it is necessary to open the application Canopy. If this is done by double-clicking the icon, it will give the error message "Enthought Canopy can't be opened because it is from an unidentified developer". To get around this, it is necessary to right-click (CTRL-click) on the icon of Canopy and choose "open". In the pop-up window choose "Open" - and the program installs.
    After this a new pop-up window appears asking "Do you want to make Canopy your default Python environment?", to which you answer "yes". 

  • Now we want install homebrew. Homebrew is a package manager similar to macports and fink. It is installed by opening the terminal and typing:

    $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

    You will be asked for your password and need to wait a few moments for the installation.
  • To install the Geos package type:

    $ brew install gdal 


    Note the location of the Geos library. For me:  /usr/local/Cellar/geos/3.5.0 
    The path written in the last line after installation indicates the location of the geos library, for me this was: /usr/local/Cellar/gdal/1.11.3_1  
  • To install Basemap it must first be downloaded. On this page, choose the newest version and download the tar-file for mac. Then go to the Downloads folder in the terminal and unpack the files:

    $ cd ~/Downloads/
    $ tar xf basemap-1.0.7.tar.gz 

    This creates a new folder with the name of the tar file, in my case ~/Downloads/basemap-1.0.7. You need to enter that folder:

    $ cd basemap-1.0.7
  • Then export the directory of geos library noted above and install baseman:

    $ export GEOS_DIR=/usr/local/Cellar/geos/3.5.0/
    To build and install write:

    $ sudo python setup.py build
    $ sudo python setup.py install

    You will be asked for your password, and the installation will take a little while to run.
  • And now python should work with basemap. You can test in the terminal by writing opening python and loading basemap:

    $ python
    >>> from mpl_toolkits import Basemap

    If this works without error messages everything is fine. For me it worked for the last two computers - this time it worked after a restart. Awesome.

mandag den 15. februar 2016

Spring rolls for Doro

For a short while I took part in the cooking group at work. I actually probably only brought food once; namely vietnamese spring rolls. They are awesome. Easy to make, delicious and reasonably healthy. I promised Doro a recipe. So here it is, only a couple of years late:

Raw vegetables
Vegetables of your choice, for example
  • Chopped cabbage
  • Sprouted seeds
  • Fresh spinach
  • Chopped carrots
  • sweet peas
  • Chopped cucumber
  • Avocado
  • Fresh koriander leaves
  • Fresh peppermint leaves
All vegetables are cut into pieces that fit in a spring roll and arranged in a dish.



Sauces
We're a bit lazy and usually just buy pre-made auster and sweet-chili sauce. And for special occasions we make our own peanut butter dressing. For that you need:     
  • Peanut butter, any type goes
  • Juice from one lime (We sometimes just use lemon juice)
  • A bit of chilli 
  • Some garlic
  • Soy sauce
  • Tap water

 The ingredients can be mixed to taste. It seems strange to add water at first, but after some stirring the dressing changes consistency as it takes up water. 

Fried filling
We like adding some fried meet or soy product. Here is one suggestion from us of what to add:

  • Grated garlic
  • Grated ginger
  • Some minced meat or soy product
  • Chopped zucchini
  • Chopped aubergine (or eggplant)
All ingredients are fried in a pan. The vegetables need quiet a long time before they're finished.














We usually put all ingredients on the table and make the spring rolls as we eat. We have a bowl of hot water on the table, the rice paper is placed in the water until it's soft, put on your plate and filled with the ingredients of choice. Enjoy!