1) Download the ice concentration data from http://nsidc.org/data/G10010
2) I am only interested in satellite data from 1979 to 2013, so extract data only for that time period:
ncea -F -d time,1549,1968 G10010_SIBT1850_v1.1.nc G10010_SIBT1850_v1.1_HH1979_2013.nc
3) Convert the data into NAA grid using SOSIE:
../bin/sosie.x -f namelist.ice2naa
4) Compute the monthly climatology (ref: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html):
for k in `seq 1 12`; do `echo "ncra -F -d time_counter,$k,420,12 icecon_G10010_SIBT1850_v1.1-naa_icecon.nc4 $k.nc"`; done
5) Concatenate the climatology for each month into a single file (ref: http://research.jisao.washington.edu/data_sets/nco/#example8):
ncrcat -h [0123456789].nc 1[012].nc icecon_mon_clim.nc
2016年9月21日水曜日
2016年9月10日土曜日
Updated python script for Lana DMS climatology csv to netCDF conversion
The script has been updated to:
Reference used to develop the script: http://qiita.com/okadate/items/954574a95545b06ca257
csv2nc.py
import netCDF4
from pylab import *
from pandas import read_csv
ncout = netCDF4.Dataset('test.nc','w')
fmonth = ['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC']
for x in range(12):
data=array(read_csv('../lana_dms_src/DMSclim_'+fmonth[x]+'.csv',header=0))
if x == 0:
dim0 = size(data,0)
dim1 = size(data,1)
lats_out = 89.5 - 1.0*arange(dim0,dtype='float32')
lons_out = -179.5 + 1.0*arange(dim1,dtype='float32')
ncout.createDimension('latitude',dim0)
ncout.createDimension('longitude',dim1)
ncout.createDimension('time',None)
lats = ncout.createVariable('latitude',dtype('float32').char,('latitude',))
lons = ncout.createVariable('longitude',dtype('float32').char,('longitude',))
lats.units = 'degrees_north'
lons.units = 'degrees_east'
lats[:] = lats_out
lons[:] = lons_out
time = ncout.createVariable('time', dtype('int32').char, ('time',))
time.long_name = 'Climatological Month'
time.units = 'days since 1968-05-23 00:00:00'
time[:] = 1 + arange(len(fmonth),dtype='float32')
dms = ncout.createVariable('DMS',dtype('float32').char,('time','latitude','longitude'))
dms.units = 'nmol L-1'
data_all = empty((len(fmonth),dim0,dim1))
data_all[x,:,:] = data
dms[:,:,:] = data_all
ncout.close()
- include the time variable to facilitate the SOSIE interpolation.
- The order of dimensions are set in a way that ferret would recognize them correctly (time, lat, lon) which gets translated in ferret as (L, J, I).
- NOTE: read_csv function has a flag header, which should be None for my Mac, but 0 for my office computer in order to extract the correct number of data in row (=180). Not sure why, but they behave differently.
- included the loop to save all 12 months in one file.
Reference used to develop the script: http://qiita.com/okadate/items/954574a95545b06ca257
csv2nc.py
import netCDF4
from pylab import *
from pandas import read_csv
ncout = netCDF4.Dataset('test.nc','w')
fmonth = ['JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC']
for x in range(12):
data=array(read_csv('../lana_dms_src/DMSclim_'+fmonth[x]+'.csv',header=0))
if x == 0:
dim0 = size(data,0)
dim1 = size(data,1)
lats_out = 89.5 - 1.0*arange(dim0,dtype='float32')
lons_out = -179.5 + 1.0*arange(dim1,dtype='float32')
ncout.createDimension('latitude',dim0)
ncout.createDimension('longitude',dim1)
ncout.createDimension('time',None)
lats = ncout.createVariable('latitude',dtype('float32').char,('latitude',))
lons = ncout.createVariable('longitude',dtype('float32').char,('longitude',))
lats.units = 'degrees_north'
lons.units = 'degrees_east'
lats[:] = lats_out
lons[:] = lons_out
time = ncout.createVariable('time', dtype('int32').char, ('time',))
time.long_name = 'Climatological Month'
time.units = 'days since 1968-05-23 00:00:00'
time[:] = 1 + arange(len(fmonth),dtype='float32')
dms = ncout.createVariable('DMS',dtype('float32').char,('time','latitude','longitude'))
dms.units = 'nmol L-1'
data_all = empty((len(fmonth),dim0,dim1))
data_all[x,:,:] = data
dms[:,:,:] = data_all
ncout.close()
2016年9月8日木曜日
How to convert the original Lana DMS climatology (in the CSV format) into the netcdf format
import netCDF4
from pylab import *
from pandas import read_csv
ncout = netCDF4.Dataset('test.nc','w')
data=array(read_csv('../dmsclimatology/DMSclim_APR.csv',header=None))
dim0 = size(data,0)
dim1 = size(data,1)
lats_out = 89.5 - 1.0*arange(dim0,dtype='float32')
lons_out = -179.5 + 1.0*arange(dim1,dtype='float32')
ncout.createDimension('latitude',dim0)
ncout.createDimension('longitude',dim1)
lats = ncout.createVariable('latitude',dtype('float32').char,('latitude',))
lons = ncout.createVariable('longitude',dtype('float32').char,('longitude',))
lats.units = 'degrees_north'
lons.units = 'degrees_east'
lats[:] = lats_out
lons[:] = lons_out
dms = ncout.createVariable('DMS',dtype('float32').char,('latitude','longitude'))
dms.units = 'nmol L-1'
dms[:] = data
ncout.close()
If you want to use this script, you would need to make sure you have those three modules and change the file name associated with the read_csv function to your own.
The output looks like this (on the right) and you can confirm that this is consistent with the published figure (on the left). NOTE: the color bar scales are different, so they don't look exactly the same.
2016年6月7日火曜日
k_dmspd
2015年12月13日日曜日
冬のバンクーバー
学会で月曜から金曜までバンクーバーへ行ってきた。今回は車で行ったのでリッチモンドへ寄れた。まさにアジアの町という感じで、ダイソーがあるAberdeen Centreでは自分がいた時間帯は客のアジア(東洋)人率100パーセントだった。セキュリティガードのおじさんたちが唯一南または中東系だった(⇦それでもアジアw)。まぁ店はダイソー以外は特にいい店はなかった。Saba Streetにあるハラール中華料理店Silkwayはあいにく閉まっていた。
宿泊はダウンタウンのウエストエンドでロブソン通りというかなりいい立地のBarclay hotelに泊まった。エレベーターがないのでベビーカーや車椅子の人にはお勧めできない。ダウンタウンで安く泊まりたいけどホステルはちょっとって人にお勧め。冬のオフシーズンなので一泊$50だった。
以下ダウンタウンで行ったレストラン&感想:
Banana leaf:マレーシア料理。お店の人が子供の対応に親切で好印象。料理はAuthenticというよりはカナダ人向けに味付けられた感じ。食べたのはRoti canaiとSeafoodカレー&炒め物。
Pappa Roti:これまたマレーシア発のカフェ。Roti自体はメキシコ発祥らしい。Rotiひとつ$3.5と高い。店の雰囲気はいいけど。
Gyoza bar:トマトスープベースの海鮮ラーメンがあるということで期待してランチで行ってみたが期待はずれだった。スープは美味しいけど拉麺とは合わない。餃子もエビとベジタリアン両方食べてみたけどどっちもフュージョン。Authenticだと思っていたので余計残念。
Guu izakaya Garlic:Authentic!普通に日本の居酒屋という感じで賑やかな店内でお店の人の叫び声が飛び交う。子供も連れて行ったが丁寧に対応してくれた。座敷に座れた。おでんが美味しい。値段も高くないのでお勧め。
Shuraku restaurant:これまたAuthenticな日本食レストラン。値段もそんなに高くない。 鰻のひつまぶしをいただいた。
Konbiniya:おにぎりが2個で$3なのが嬉しい。賞味期限切れ間近のカルピスが$1で売られていたのも良かった。
宿泊はダウンタウンのウエストエンドでロブソン通りというかなりいい立地のBarclay hotelに泊まった。エレベーターがないのでベビーカーや車椅子の人にはお勧めできない。ダウンタウンで安く泊まりたいけどホステルはちょっとって人にお勧め。冬のオフシーズンなので一泊$50だった。
以下ダウンタウンで行ったレストラン&感想:
Banana leaf:マレーシア料理。お店の人が子供の対応に親切で好印象。料理はAuthenticというよりはカナダ人向けに味付けられた感じ。食べたのはRoti canaiとSeafoodカレー&炒め物。
Pappa Roti:これまたマレーシア発のカフェ。Roti自体はメキシコ発祥らしい。Rotiひとつ$3.5と高い。店の雰囲気はいいけど。
Gyoza bar:トマトスープベースの海鮮ラーメンがあるということで期待してランチで行ってみたが期待はずれだった。スープは美味しいけど拉麺とは合わない。餃子もエビとベジタリアン両方食べてみたけどどっちもフュージョン。Authenticだと思っていたので余計残念。
Guu izakaya Garlic:Authentic!普通に日本の居酒屋という感じで賑やかな店内でお店の人の叫び声が飛び交う。子供も連れて行ったが丁寧に対応してくれた。座敷に座れた。おでんが美味しい。値段も高くないのでお勧め。
Shuraku restaurant:これまたAuthenticな日本食レストラン。値段もそんなに高くない。 鰻のひつまぶしをいただいた。
Konbiniya:おにぎりが2個で$3なのが嬉しい。賞味期限切れ間近のカルピスが$1で売られていたのも良かった。
登録:
投稿 (Atom)

