2014年9月27日土曜日

チャイルドシート

日曜日。

Carshareを利用して Fisgardの駐車場に停まっているトヨタカローラをピックアップしていざ買い物!

Root cellarsへ行き、Fujiyaへ行き、Hillside Mallで昼ご飯を食べ、時間が余ったのでWalmartにでも行ってみようかということになり運転していると

Yard Saleのサインが。

TopazとFifthと書いてあったので行ってみると

子供用品がいっぱい。

そしてチャイルドシートがあって売り手の方と話をしてみると2010年製のもので無料で譲ってくれるとのこと。

さらに赤ちゃんのおもちゃもいただいた。ラッキーな有難い一日だった。


↑チャイルドシート


↑これが頂いたおもちゃ


↑カナダのチャイルドシートには製造年月日と使用期限が記載されていて期限内のものを使わないといけない。

↑チャイルドシートの認証シール。だと思う。

追伸:

このチャイルドシートの名前は





evenflo embrace with the Z handle




らしい。これを取り付けられることが可能なベビーカーを探さないといけない。

2014年9月25日木曜日

python2→3はマジで困る

python3で出来てpython2で出来ないことがあるのはわかるけど

python2で出来たことがpython3ではできなくなってることは理解不能。

例えば:

python2.7では

>>> print 'Parsing %s...'

Parsing %s...

と無事できるのに

python3.4でやってみると

>>> print 'Parsing %s...'
  File "<stdin>", line 1
    print 'Parsing %s...'
                        ^
SyntaxError: invalid syntax

っとなる。

自分のコードなら3用に簡単に書き換えられるけど2をベースにしたモデル屋さんのソースコードとなると書き換えてとは簡単には頼めない。

まじで困る。せっかく3.4に必要なモジュールインストールしてpythonのデフォルトにしたのにこれじゃまた2に逆戻りせざるを得ないじゃないか…。

sudo port select --set python python27

↑pythonコマンドで起動されるpythonを3.4から2.7に変更。

sudo port install py27-netcdf4 py27-matplotlib py27-scipy py27-numpy py27-yaml

↑必要そうなmoduleをインストール。

以上設定変更したら無事以下のスクリプトを走らせることができた。

python parse_standard_variables.py

2014年9月16日火曜日

failed to cmake, but succeeded with make

cmake -L ~/GOTM/gotm-git/src 
.
.
.
NetCDF_INCLUDE_DIRS:PATH=/usr/include
NetCDF_LIBRARIES:STRING=-lnetcdf

"make" produces an error (not locating the appropriate netcdf directory).

head /usr/include/netcdf.inc 
!     NetCDF-3.
!
! netcdf version 3 fortran interface:
.
.
.

Thus, by the current (default) setting, cmake is choosing netcdf3, which cannot be used in FABM-GOTM (we need netcdf4). We need to manually set the location of netcdf libraries (and include as well?).

cmake -L -DNetCDF_LIBRARIES=/usr/local/netcdf-4.3.0_GF/lib ~/GOTM/gotm-git/src
-- Found NetCDF: /usr/local/netcdf-4.3.0_GF/lib
-- Configuring done
WARNING: Target "gotm_exe" requests linking to directory "/usr/local/netcdf-4.3.0_GF/lib".  Targets may link only to libraries.  CMake is dropping the item.
.
.
.
NetCDF_INCLUDE_DIRS:PATH=/usr/include

NetCDF_LIBRARIES:STRING=/usr/local/netcdf-4.3.0_GF/lib

"make" still produces an error. probably /usr/include is not right and I need to specify the path for it as well.

cmake -L -DNetCDF_LIBRARIES=/usr/local/netcdf-4.3.0_GF/lib -DNetCDF_INCLUDE_DIRS=/usr/local/netcdf-4.3.0_GF/include ~/GOTM/gotm-git/src
.
.
.
NetCDF_INCLUDE_DIRS:PATH=/usr/local/netcdf-4.3.0_GF/include

NetCDF_LIBRARIES:STRING=/usr/local/netcdf-4.3.0_GF/lib

make
.
.
.
gotm_fabm_output.F90:(.text+0x217a): undefined reference to `__netcdf_MOD_nf90_put_att_one_fourbyteint'
collect2: error: ld returned 1 exit status
make[2]: *** [gotm] Error 1
make[1]: *** [CMakeFiles/gotm_exe.dir/all] Error 2
make: *** [all] Error 2

Still the same error...

I gave up on "cmake" for now. Instead I tried the good old "make" compilation in ~/GOTM/gotm-git/src.

and I was able to do compile with the following script:

doit.sh
#! /bin/sh
export PATH=/usr/local/netcdf-4.3.0_GF/bin:$PATH
export FORTRAN_COMPILER=GFORTRAN
export NETCDF_VERSION=NETCDF4

make

Providing the path to netcdf bin folder helped.

This can be coupled to FABM which is built using the new cmake system:

doit_couple.sh
#! /bin/sh
export PATH=/usr/local/netcdf-4.3.0_GF/bin:$PATH
export FABMDIR=$HOME/FABM/fabm-git
export FORTRAN_COMPILER=GFORTRAN
export FABM=true
export FABM_PREFIX=$HOME/local/fabm/gotm
export NETCDF_VERSION=NETCDF4

make

For now, this is sufficient to couple FABM and GOTM.