Return to Snippet

Revision: 8260
at September 23, 2008 06:01 by shrad


Updated Code
from mpl_toolkits.basemap import Basemap
from scipy.io.numpyio import fread
import matplotlib.pyplot as plt
import matplotlib.numerix.ma as M
import matplotlib.colors as C
from pylab import *
import numpy as np
import scipy as sc
import os, fnmatch
import array
import sys
import datetime

d=str(datetime.date.today())
d=d.replace('-', '')

path='c:/' #sys.argv[1]
for fn in os.listdir(path):
    if fnmatch.fnmatch(fn, d + '*.b*'):
        fileName=path + fn
        break

masking=True
treshold=0
savename=d + '_SO2.png'
dpi=120
smoothness=1
projection='mill'
titre='SO2'
legende='Delta Brightness Temperature (K)'
centre=[-90,0]

print('reading binary data')
Lat=[]
Lon=[]
Val=[]

nbreligne=long(os.stat(fileName)[6])/(8*int(fileName[-2:]))
rawfile=np.fromfile(open(fileName,'rb'),'d',-1)        
Lat=rawfile[0:nbreligne]
Lon=rawfile[nbreligne:nbreligne*2]
Val=rawfile[nbreligne*21:nbreligne*22]    

if(masking==True):
    i=0
    while(i<nbreligne):
        if(Val[i]>-1.1):
            Val[i]=-1.1
        i+=1

print('plotting data')
map=Basemap(projection='mill',lat_0=-90,lon_0=0,llcrnrlat=-90,urcrnrlat=90,\
            urcrnrlon=180,llcrnrlon=-180,resolution='i',area_thresh=30000.)

xi=np.linspace(-180,180,360*smoothness) #1440
yi=np.linspace(-90,90,180*smoothness)    #720
zi=griddata(Lon,Lat,Val,xi,yi)

topodat=map.transform_scalar(zi,xi,yi,720,1440)
map.imshow(topodat,cm.winter, interpolation='bilinear',aspect='auto',norm = C.Normalize(vmin = -5., vmax = -1.2, clip = True),extent=[-180,180,-90,90],filternorm=1)

cb=plt.colorbar(shrink=0.7)
cb.ax.set_ylabel(legende,fontsize=11)
for t in cb.ax.get_yticklabels():
    t.set_fontsize(7)

meridians = arange(-180,180,60)
parallels = arange(-90,90,30)
map.drawparallels(parallels,labels=[1,0,0,0],fontsize=7,linewidth=0.25)
map.drawmeridians(meridians,labels=[0,0,0,1],fontsize=7,linewidth=0.25)

title(titre)

print('saving map')        
map.drawcoastlines(0.25,antialiased=1)
plt.savefig(savename,dpi=dpi)
print('done')

Revision: 8259
at September 17, 2008 09:10 by shrad


Updated Code
from mpl_toolkits.basemap import Basemap
from scipy.io.numpyio import fread
import matplotlib.pyplot as plt
import matplotlib.numerix.ma as M
import matplotlib.colors as C
from pylab import *
import numpy as np
import scipy as sc
import os
import array

fileName="c:/20080821.b56"

print('reading binary data')
nbreligne=long(os.stat(fileName)[6])/(8*int(fileName[-2:]))
Lat=[]
Lon=[]
Val=[]
rawfile=np.fromfile(open(fileName,'rb'),'d',-1)        
Lat=rawfile[0:nbreligne]
Lon=rawfile[nbreligne:nbreligne*2]
Val=rawfile[nbreligne*21:nbreligne*22]

hstack((Lon,[-180,180,-180,180]))
hstack((Lat,[91,91,-91,-91]))
hstack((Val,[0,0,0,0]))

i=0
while(i<nbreligne):
    if(Val[i]>-1.2):
        Val[i]=0
    i+=1

print('plotting data')
map=Basemap(projection='mill',lat_0=90,lon_0=0,llcrnrlat=-90,urcrnrlat=90,\
            urcrnrlon=180,llcrnrlon=-180,resolution='i',area_thresh=30000.)

xi=np.linspace(-180,180,1440)
yi=np.linspace(-90,90,720)
zi=griddata(Lon,Lat,Val,xi,yi)

topodat=map.transform_scalar(zi,xi,yi,720,1440)
map.imshow(topodat,cm.hot, interpolation='bilinear',aspect='auto')

cb=plt.colorbar(shrink=0.7)
cb.ax.set_ylabel('Delta Brightness Temperature (K)',fontsize=11)
for t in cb.ax.get_yticklabels():
    t.set_fontsize(7)

meridians = arange(-180,180,60)
parallels = arange(-90,90,30)
map.drawparallels(parallels,labels=[1,0,0,0],fontsize=7,linewidth=0.25)
map.drawmeridians(meridians,labels=[0,0,0,1],fontsize=7,linewidth=0.25)
title('SO2')

print('saving map')        
map.drawcoastlines(0.25,antialiased=1)
plt.savefig("testfig.png",dpi=200)
print('done')

Revision: 8258
at September 17, 2008 07:20 by shrad


Updated Code
from mpl_toolkits.basemap import Basemap
from scipy.io.numpyio import fread
import matplotlib.pyplot as plt
import matplotlib.numerix.ma as M
import matplotlib.colors as C
from pylab import *
import numpy as np
import scipy as sc
import os
import array

fileName="c:/20080821.b56"

print('reading binary data')
nbreligne=long(os.stat(fileName)[6])/(8*int(fileName[-2:]))
Lat=[]
Lon=[]
Val=[]
rawfile=np.fromfile(open(fileName,'rb'),'d',-1)        
Lat=rawfile[0:nbreligne]
Lon=rawfile[nbreligne:nbreligne*2]
Val=rawfile[nbreligne*21:nbreligne*22]
#masking values below a certain treshold
Val=M.array(Val)
Val_masked = M.masked_where(Val > -1.2, Val)

print('plotting data')
map=Basemap(projection='mill',lat_0=90,lon_0=0,llcrnrlat=-90,urcrnrlat=90,\
            urcrnrlon=180,llcrnrlon=-180,resolution='i',area_thresh=30000.)

x,y = map(Lon,Lat)

palette = cm.hot
plt.scatter(x,y,s=0.5,c=Val_masked,marker='s',edgecolor="None",cmap=palette,antialiased=1,vmin=-5,vmax=0)
cb=plt.colorbar(shrink=0.7)
cb.ax.set_ylabel('Delta Brightness Temperature (K)',fontsize=11)
for t in cb.ax.get_yticklabels():
    t.set_fontsize(7)

meridians = arange(-180,180,60)
parallels = arange(-90,90,30)
map.drawparallels(parallels,labels=[1,0,0,0],fontsize=7,linewidth=0.25)
map.drawmeridians(meridians,labels=[0,0,0,1],fontsize=7,linewidth=0.25)
title('SO2')

print('saving map')        
map.drawcoastlines(0.25,antialiased=1)
plt.savefig("testfig.png",dpi=600)
print('done')

Revision: 8257
at September 12, 2008 04:55 by shrad


Updated Code
from mpl_toolkits.basemap import Basemap
from scipy.io.numpyio import fread
import matplotlib.pyplot as plt
import numpy as np
import os
import array

fileName="c:/20080808.b56"

print('reading binary data')
nbreligne=long(os.stat(fileName)[6])/(8*int(fileName[-2:]))
Lat=[]
Lon=[]
Val=[]
rawfile=np.fromfile(open(fileName,'rb'),'d',-1)        
Lat=rawfile[0:nbreligne]
Lon=rawfile[nbreligne:nbreligne*2]
Val=rawfile[nbreligne*21:nbreligne*22]

print('plotting data')
map=Basemap(projection='mill',llcrnrlat=-90,urcrnrlat=90,\
            urcrnrlon=180,llcrnrlon=-180,resolution='i',area_thresh=30000.)
x,y = map(Lon,Lat)
plt.scatter(x,y,s=0.25,c=Val,marker='s',edgecolor="None",cmap=plt.cm.jet_r)
plt.colorbar(shrink=0.6)

print('saving map')        
map.drawcoastlines(0.5,antialiased=1)
plt.savefig("testfig.png",dpi=600)
print('done')

Revision: 8256
at September 11, 2008 05:14 by shrad


Updated Code
from mpl_toolkits.basemap import Basemap
from scipy.io.numpyio import fread
import matplotlib.pyplot as plt
import numpy as np
import os
import array

fileName="c:/20080821.b56"

print('preparing map')    
map = Basemap(projection='mill',lat_0=0,lon_0=0,resolution='i',area_thresh=30000.)
map.drawmapboundary()

print('reading binary data')
nbreligne=long(os.stat(fileName)[6])/(8*int(fileName[-2:]))
Lat=zeros(nbreligne)
Lon=zeros(nbreligne)
Val=zeros(nbreligne)
rawfile=fromfile(open(fileName,'rb'),'d',-1)        
Lat=rawfile[0:nbreligne]
Lon=rawfile[nbreligne:nbreligne*2]
Val=rawfile[nbreligne*21:nbreligne*22]

print('plotting data')

#plotting code comes here 

print('saving map')        
map.drawcoastlines(0.5,antialiased=1)
plt.savefig("testfig.png",dpi=600)
print('done')


"""
data sample, in csv format to help (original format is binary)

55.43408,18.93492,-0.0805283297001
55.65594,18.69336,-0.0165396478299
55.39653,17.95341,-0.159633749935
55.1686,18.21064,-0.16578947683
56.05425,20.67698,-0.0477433859859
56.26184,20.4599,-0.236785443325
56.05808,19.83327,-0.174454108777
55.84546,20.063,-0.105833258631
56.55636,22.18289,-0.222061925153
56.75244,21.98536,0.0788714176062
56.58621,21.43966,-0.154624999287
56.3859,21.64768,-0.433975442176
56.97617,23.51148,-0.363889174142
57.16283,23.32988,-0.326642036096
57.02328,22.84423,-0.392874724019
56.83303,23.03473,-0.0468267940378
57.33601,24.70979,-0.377258992607
57.51486,24.54143,-0.306733693853
57.39505,24.10173,-0.385806167909
57.21311,24.27777,-0.338766943855
57.65124,25.80545,-0.488919606991
57.82361,25.64822,-0.0753473452728
57.71884,25.24426,-0.209712199957
57.54378,25.4082,-0.254613867431
57.92938,26.82162,-0.297595537582
58.09642,26.67389,-0.116822717586
58.00329,26.29802,-0.253206057137
57.83394,26.45171,-0.305537545021
58.18067,27.77444,-0.106670908565
58.3433,27.63485,-0.398487440893
58.2594,27.28114,-0.175937920067
58.09478,27.42607,-0.104071104899
58.41049,28.67891,0.0113875336806
58.56953,28.54638,0.0938825475507
58.49304,28.2101,-0.039588994647
58.33228,28.34746,-0.126131786143
58.62139,29.54378,0.22402061648
58.7776,29.4174,0.167174480496
58.70709,29.09461,-0.146803925144
58.54941,29.22541,-0.107942152819
58.81813,30.37979,-0.201042075249
58.97218,30.25881,0.0350429564847
58.90655,29.94619,0.0378178791648
58.75127,30.07124,-0.0450178901512
59.00249,31.19578,-0.160756218677
59.155,31.07957,0.0851867502124
59.09336,30.77421,0.159908902741
58.93983,30.89421,-0.104832327861
59.32885,31.88364,0.168472328492
59.27048,31.58289,-0.13527845741
59.1181,31.69844,-0.252389453432
59.34286,32.79024,0.0715234868688
59.49403,32.68201,-0.160467199443
59.43832,32.38343,-0.22586879847
59.28652,32.49501,-0.116040212984
59.50239,33.58414,-0.418014636395
59.65374,33.4793,0.0827008649168
59.60018,33.18051,-0.281167016171
59.4484,33.28854,0.0893654258151
59.65598,34.38188,-0.0742561330362
59.80807,34.28011,-0.118927456007
59.75622,33.97873,-0.0125540661867
59.60391,34.08358,0.0969616900968
59.80618,35.19326,-0.0806431891567
59.95959,35.09432,0.0722590223517
59.90908,34.78788,-0.195121201904
59.75565,34.88983,0.068872494284
59.95244,36.0228,0.115389025711
60.10776,35.92648,-0.035110313847
60.05826,35.61237,0.0143769214191
59.90312,35.71165,-0.0214684570321
60.09486,36.87882,0.0917418681136
60.25274,36.785,-0.189308526549
60.20396,36.46035,-0.14656052679
60.0465,36.55712,-0.017306804852
60.2359,37.77062,-0.203860870502
60.39703,37.67924,0.017649388173
60.34871,37.34073,-0.0549313714711
60.18824,37.43509,-0.0176920637382
60.37565,38.70595,-0.162479588456
60.54079,38.61703,-0.135993266847
60.4927,38.26085,-0.156104852832
60.32849,38.35283,-0.197950719157
60.51689,39.69819,-0.209741870645
60.68693,39.61186,-0.112610089383
60.63886,39.23335,-0.358365229218
60.47006,39.3229,-0.232242115659
60.65292,40.7573,-0.0426641233255
60.82881,40.6738,-0.202393896875
60.78066,40.26748,-0.268720605726
60.60636,40.35442,-0.198197814709
60.79082,41.911,-0.503157101635
60.97375,41.83079,0.0282700969038
60.92543,41.38934,-0.470323231406
60.74451,41.47332,-0.261783091714
60.92601,43.16807,-0.426038322374
61.11729,43.0918,-0.173238480674
61.06888,42.60628,-0.533297218066
60.88009,42.68677,-0.571425084699
61.06068,44.57369,-0.375377387561
61.26204,44.50242,-0.203264421948
61.21376,43.96026,-0.526357375901
61.0155,44.03641,-0.389456408772
61.1933,46.15876,-0.278064052216
61.40679,46.09408,-0.184807598893
61.35922,45.47841,-0.443733942832
61.14958,45.54893,-0.176115849771
61.31792,47.97882,-0.175915367873
61.54614,47.92314,-0.332999145366
61.50053,47.20998,-0.327693119169
61.27713,47.27292,-0.512683931386
61.4292,50.12846,-0.855679430525
61.67564,50.08562,-0.988716708132
61.63455,49.23824,-0.81101328509
61.39422,49.29049,-0.621722957813
61.51569,52.7362,-0.770084833265
61.78509,52.71249,-0.758481319269
61.75377,51.67218,-1.14538032145
61.49226,51.70875,-1.10133347158
55.8424,18.48067,-0.0640369640569
56.06332,18.23382,-0.0103156902688
55.80097,17.48929,-0.202164760011
55.57407,17.75205,-0.022936996848
56.46783,20.2341,-0.0587199566258
56.67464,20.01215,0.0197566670723
56.46849,19.38109,-0.376557761846
56.25672,19.61588,-0.103198634131
56.97594,21.7521,-0.404707436881
57.17134,21.55006,-0.419518472112
57.00318,21.00017,-0.113926586151
56.80361,21.21286,0.0275223662911
57.40062,23.09009,-0.559829316427
57.58668,22.90426,-1.69462554093
57.44549,22.41454,-1.48432840798
57.25588,22.60943,-0.533665983382
57.76443,24.299,-0.770262219093
57.94276,24.12666,-0.766524178939
57.82155,23.68306,-0.984606710557
57.64016,23.86321,-0.692963800929
58.08167,25.40532,-0.344926574739
58.25358,25.24436,-0.491623433506
58.14755,24.83664,-0.763184645077
57.97299,25.00444,-0.302654500364
58.36419,26.42991,-0.0956080405355
58.5308,26.27862,-0.0946882532468
58.43658,25.89906,0.0726764520377
58.26768,26.05642,-0.151463850187
58.61843,27.39331,-0.242313995975
58.78067,27.25034,-0.0699298133493
58.6958,26.89305,-0.57764400955
58.53158,27.04145,-0.234421796316
58.84884,28.30748,0.135074222767
59.00754,28.17174,0.138238122124
58.93015,27.83194,0.0414132125989
58.76975,27.97261,0.011214730638
59.06281,29.17937,0.119566276382
59.21871,29.0499,0.187243287726
59.14738,28.72359,0.0149191957819
58.99003,28.85757,-0.0390616818869
59.2611,30.02477,0.0747559932326
59.41487,29.90081,0.220487257705
59.34848,29.58469,0.068109004935
59.19348,29.71279,-0.0172706090271
59.44767,30.84989,-0.189308130666
59.59992,30.73081,0.0810483500856
59.53758,30.42194,-0.0981822817054
59.38432,30.54488,-0.19495116536
59.62449,31.65938,0.0979034822678
59.77581,31.54461,-0.0132797388779
59.71677,31.24032,-0.0328273109464
59.56464,31.35871,0.128220101605
59.79233,32.46328,-0.164046269649
59.94329,32.35237,-0.0342775732362
59.88695,32.05019,0.0461190624867
59.73538,32.16452,0.171323695745
59.95422,33.26396,0.283535962901
60.10537,33.15651,-0.0186519049885
60.05121,32.85402,-0.133803526827
59.89965,32.96473,-0.0306730382099
60.10885,34.07496,0.0856285758582
60.26077,33.97069,0.145922412453
60.20836,33.66551,-0.0737607968218
60.05623,33.77294,-0.00586342522612
60.25952,34.89546,-0.0931432175501
60.41276,34.79408,0.0229998286254
60.36172,34.48372,-0.0949715362198
60.20846,34.58817,0.0260944169557
60.40696,35.73512,-0.469965541178
60.56214,35.63645,-0.180670450909
60.51213,35.31825,-0.232114388562
60.35715,35.41995,-0.078999342147
60.55146,36.60286,-0.198349562378
60.70921,36.50676,0.0249286290068
60.65994,36.17778,-0.221439342135
60.50261,36.2769,-0.263777834574
60.69393,37.50744,-0.0835244187448
60.85495,37.41387,-0.161877147207
60.80616,37.07075,0.072596070438
60.64581,37.16738,-0.166062431263
60.83506,38.45432,-0.105310563846
61.00011,38.36329,-0.0560213342967
60.95157,38.00219,-0.0497159618389
60.78746,38.09637,-0.0909648931065
60.97408,39.46116,-0.0493172985172
61.14403,39.37281,-0.0764405673964
61.09557,38.98903,-0.315570441475
60.92687,39.08067,-0.195482040453
61.11297,40.53939,-0.484068922566
61.28881,40.454,-0.4431741123
61.24029,40.04178,-0.43914085922
61.06605,40.1307,-0.315949727424
61.25173,41.70385,-0.146140014216
61.43459,41.62186,-0.763921144272
61.38594,41.17407,-0.261179453706
61.20508,41.25992,-0.0831950424973
61.38949,42.98218,-0.336701934326
61.58076,42.9043,-0.429597465368
61.53204,42.41155,-0.167162453383
61.34327,42.49376,-0.0190406737609
61.52581,44.40625,-0.527862289105
61.72716,44.33359,-0.275752864749
61.67863,43.7833,-0.21309654711
61.48039,43.86098,-0.611249884432
61.65699,46.01457,-0.176180210054
61.87048,45.94877,-0.0738913747708
61.82279,45.32381,-0.328710949248
61.61316,45.39561,-0.276065655617
61.78098,47.86141,-0.410434456362
62.0092,47.80499,-0.214336928897
61.96366,47.081,-0.153110325609
61.74026,47.14488,-0.138834620867
61.89341,50.0463,-0.975210218153
62.13989,50.00331,-1.02702674444
62.09909,49.14272,-1.08939317033
61.85871,49.19541,-0.958072495789
61.97753,52.69197,-0.852620796865
62.24695,52.66887,-0.764189528262
62.21638,51.61249,-0.900900301379
61.95484,51.64885,-0.899157910761
56.24633,18.01652,-0.069648960924
56.4663,17.76422,-0.0462078347799
56.20083,17.01509,-0.198394046871
55.97497,17.28351,-0.019809245521
56.88081,19.78439,-0.071548344221
57.08678,19.55744,-0.15840923113
56.87828,18.92212,-0.000616475796505
56.66741,19.1621,0.0489671425682
57.39552,21.31177,-1.49350565873
57.59019,21.10505,-0.737446291398
57.42011,20.55097,-1.41993214904
57.22132,20.76852,-0.372437801629
57.8231,22.65848,-0.821949266487
58.00854,22.46825,-0.307590221796
57.86567,21.97441,-0.305397216432
57.67671,22.17384,-1.6060628396
58.19132,23.87827,-0.676061916594
58.36909,23.70181,-0.670160334855
58.24644,23.25425,-0.727406734742
58.06564,23.43866,-0.818831871505
58.51223,24.99294,-0.77649924891
58.68366,24.82806,-0.830196630168
58.57636,24.41646,-1.33850101185
58.40232,24.58829,-1.35135559316
58.79798,26.02786,-0.35388207976
58.96416,25.87286,-0.257123768587
58.86882,25.48954,-0.102117412953
58.70038,25.65072,-0.302096407869
59.05486,27.00215,0.0684497175442
59.2167,26.85566,-0.00248245390901
59.13083,26.49472,0.0476402799159
58.96703,26.64673,-0.310180036685
59.28852,27.92351,0.0695267627481
59.44686,27.78439,0.103122104091
59.36856,27.44094,-0.0445804272808
59.20853,27.58508,-0.175356579374
59.50411,28.80654,-0.133088161895
59.65969,28.67384,0.146711483354
59.58751,28.34395,0.00889387565451
59.4305,28.48124,0.119820316203
59.70449,29.66137,0.101168880514
59.85796,29.53431,0.0209053844156
59.79079,29.21462,-0.147781349442
59.63611,29.3459,0.0811982628375
59.89341,30.4949,0.329724445319
60.04539,30.37281,0.0588938931255
59.98232,30.06035,-0.0631487378137
59.82935,30.18636,-0.016239821604
60.07099,31.31576,0.00938996587303
60.22206,31.19811,0.423283516648
60.16234,30.89021,-0.0739701268728
60.01048,31.01154,-0.0380112494194
60.24029,32.12728,0.083516896837
60.39102,32.01358,0.149384803517
60.33403,31.70771,0.0776030237375
60.1827,31.8249,0.0119132019246
60.40308,32.94021,-0.138884359094
60.49926,32.52382,0.0436385157984
60.34791,32.63729,0.0195864921159
60.55974,33.75876,-0.275344616836
60.71146,33.65186,-0.143121330975
60.65847,33.3428,0.128326428264
60.50654,33.45291,-0.181680608109
60.71269,34.59044,-0.0592434323091
60.86577,34.48651,0.123391602687
60.81417,34.17212,-0.0995688430129
60.66109,34.27917,-0.207244995014
60.86193,35.44158,0.259187135054
61.01696,35.34044,-0.0380031024806
60.96641,35.01801,-0.024974708557
60.81159,35.12224,-0.0719060499401
61.00765,36.32054,-0.417028382372
61.16526,36.22205,-0.13069549096
61.11548,35.88862,-0.3257877149
60.9583,35.9902,-0.00189038296421
61.15227,37.23547,0.137847202692
61.31316,37.13958,-0.175692616281
61.26387,36.79175,-0.0876023932221
61.10366,36.89077,-0.110461371556
61.29427,38.19601,-0.0265604027334
61.45921,38.10275,-0.108676963622
61.4102,37.7366,-0.278222078686
61.24621,37.83307,-0.0700890061237
61.43451,39.21621,-0.1189295339
61.60436,39.12574,-0.0677211616143
61.55545,38.73651,-0.0500642310498
61.38685,38.83036,-0.0934598805762
61.57536,40.30991,-0.520638479836
61.75112,40.22251,-0.280978734465
61.70217,39.80433,-0.350330562093
61.52801,39.89535,-0.319276021342
61.7144,41.49445,-0.0771946477516
61.89722,41.4106,-0.189765945259
61.84819,40.95614,-0.345048405829
61.66738,41.04395,-0.452846333521
61.85229,42.79304,-0.229300417108
62.04354,42.71348,-0.170733643162
61.9945,42.21325,-0.235322478696
61.80576,42.29726,-0.307210471866
61.98842,44.23271,-0.262134650476
62.18973,44.15857,-0.277900906183
62.14096,43.60005,-0.0669636517054
61.94276,43.67935,-0.18393206304
62.33344,45.80063,-0.354375390246
62.28564,45.16609,-0.116198520614
62.07602,45.23924,-0.399035040214
62.2455,47.74615,-0.209559909505
62.47377,47.68899,-0.660398953663
62.42824,46.95354,-0.247118167995
62.20481,47.0184,-0.240928797074
62.35641,49.9604,-0.940895378251
62.60291,49.9172,-0.684326233283
62.56241,49.0432,-0.96143058565
62.32203,49.09641,-0.89574626818
62.43991,52.64745,-0.497278240824
62.70936,52.62499,-0.447968759284
62.67952,51.55206,-0.505711404829
62.41796,51.5882,-0.75697265016
56.65194,17.54335,-0.0473637105351
56.87088,17.28542,-0.163008011152
56.60244,16.53184,-0.212335017726
56.37769,16.80611,-0.0545003801602
57.2925,19.31827,-0.0419092947137
57.49762,19.08606,-0.549446413417
57.28663,18.44615,-0.00293049070723
57.07669,18.6916,-0.0884348995943
57.81164,20.85946,-0.272693405723
58.00557,20.64788,-0.340601350749
57.83344,20.0895,-0.319372935013
57.63544,20.31207,-0.519168268592
58.24303,22.21834,-0.120358372267
58.42784,22.02358,-0.124155127512
58.28321,21.52564,-0.193724733671
58.09494,21.72974,-0.256087744284
58.61566,23.44631,-0.425440936427
58.79288,23.26556,-0.113257566781
58.66871,22.81395,-0.178263321962
58.4885,23.00278,-0.25477048913
58.94165,24.57325,-0.600678160407
59.11257,24.40434,-0.782518801796
59.00398,23.98887,-0.941121041703
58.83048,24.16487,-1.34024592779
59.22951,25.61876,-0.215678312995
59.39522,25.45993,-0.255317205566
59.29872,25.07286,-0.154355822707
59.13078,25.23797,-0.0709053324374
59.48888,26.60029,-0.0213775439551
59.65032,26.45014,0.122778811995
59.56338,26.08545,-0.0471227774191
59.40001,26.24124,-0.334946845507
59.72598,27.53173,-0.0174928837496
59.88395,27.38909,0.0190145101231
59.8047,27.04196,0.00133225618387
59.64506,27.18971,-0.0664909375388
59.94383,28.42545,0.0934017749227
60.09907,28.28939,0.100160407266
60.02603,27.95585,0.183676599863
59.86938,28.09659,-0.0633052919482
60.14666,29.288,0.143911864977
60.29982,29.1577,0.125552079077
60.23184,28.83434,0.0105140239287
60.0775,28.96895,0.163303883474
60.33707,30.13342,-0.103626283309
60.48876,30.00823,-0.0181887651137
60.42495,29.69211,-0.14415858611
60.27227,29.82131,-0.0966675610111
60.51667,30.96199,-0.0389360580313
60.66748,30.84132,0.0420826807354
60.60706,30.5297,-0.115229134215
60.45547,30.65413,0.021906802845
60.6882,31.78403,-0.0897375362466
60.83869,31.66741,0.0675227759993
60.78104,31.35777,-0.18283808811
60.62997,31.47795,0.020004677301
60.85301,32.60657,-0.228021231743
61.00373,32.4936,0.0813307946582
60.94834,32.18348,-0.0468687876811
60.79722,32.29985,-0.185571670903
61.01125,33.43543,0.135114442669
61.16277,33.32578,0.0186515678206
61.10918,33.01272,-0.140933909482
60.95746,33.12565,0.00762241449723
61.16477,34.27784,-0.0198549429826
61.31766,34.17125,0.0887441152565
61.26549,33.85271,0.103914627021
61.11261,33.9625,-0.117917310384
61.31677,35.14135,0.154437403956
61.47163,35.03761,-0.0753275224521
61.42054,34.71083,0.0258870250015
61.26589,34.81772,-0.0523903565777
61.4631,36.03166,-0.128517817345
61.62056,35.93066,-0.103846495289
61.57025,35.59265,-0.128615304229
61.41322,35.6968,0.0191583760825
61.60792,36.96003,-0.0931040684277
61.76868,36.86172,-0.172167260613
61.7189,36.50903,-0.233142573383
61.55882,36.61052,-0.319899671359
61.75304,37.93394,-0.202313890446
61.91788,37.83835,-0.0708433874735
61.86838,37.46695,-0.0980153571342
61.7045,37.56582,-0.235253508286
61.89347,38.96814,-0.0597153654593
62.06323,38.87544,-0.139008257256
62.01387,38.48056,-0.206416222293
61.84537,38.57671,-0.335753532189
62.03528,40.07592,-0.138807988351
62.21095,39.9864,-0.240540378289
62.16158,39.56209,-0.430337970416
61.98752,39.6553,-0.251373787793
62.17563,41.2772,-0.248184132787
62.35838,41.19138,-0.372188901324
62.30896,40.73016,-0.522219473893
62.12824,40.82004,-0.559804583229
62.31453,42.59604,-0.183250847341
62.50572,42.5147,-0.069878795412
62.45636,42.00687,-0.447920504435
62.26768,42.09278,-0.227162239943
62.45074,44.06146,-0.13184089399
62.65204,43.98579,-0.0804840691534
62.60303,43.41852,-0.369821595305
62.40485,43.4995,-0.289333385344
62.5848,45.71735,-0.244368430819

"""

Revision: 8255
at September 11, 2008 04:53 by shrad


Initial Code
from mpl_toolkits.basemap import Basemap
from scipy.io.numpyio import fread
import matplotlib.pyplot as plt
import numpy as np
import os
import array

fileName="c:/20080821.b56"

print('preparing map')    
map = Basemap(projection='mill',lat_0=0,lon_0=0,resolution='i',area_thresh=30000.)
map.drawmapboundary()

print('reading binary data')
nbreligne=long(os.stat(fileName)[6])/(8*int(fileName[-2:]))
Lat=zeros(nbreligne)
Lon=zeros(nbreligne)
Val=zeros(nbreligne)
rawfile=fromfile(open(fileName,'rb'),'d',-1)        
Lat=rawfile[0:nbreligne]
Lon=rawfile[nbreligne:nbreligne*2]
Val=rawfile[nbreligne*21:nbreligne*22]

print('shifting latitudes and projecting to map')
i=0
while i < nbreligne:
    if(Lon[i]>180):
        print(Lon[i])
        Lon[i]-=360
        print(Lon[i])
    i+=1

print('plotting data')

#plotting code comes here 

print('saving map')        
map.drawcoastlines(0.5,antialiased=1)
plt.savefig("testfig.png",dpi=600)
print('done')

Initial URL

                                

Initial Description

                                

Initial Title
map plotting python code (temporary)

Initial Tags

                                

Initial Language
Python