It's easy to extract meteorological data in MeteoInfoLab with script. Firstly create a data file object using 'addfile' function, and then get data by sepcific dimensions. For example, T02M has 4 dimensions (time, level, lat, lon), 2 dimension array can be extracted by fixing time and level dimension. T02M only has one level, so the level index is allways 0. ':' means read all range data of the dimension.
Code: Select all
#Open an ARL data file
f = addfile('D:/Temp/arl/gdas1.jul09.w5')
#Read a 2 dimension (lat, lon) data array from the file
tidx = 0
t = f.gettime(tidx)
lidx = 0
data = f['T02M'][tidx,lidx,:,:]
#Plot
axesm()
mlayer = shaperead('D:/Temp/map/country1.shp')
geoshow(mlayer, linecolor=[0,0,255])
layer = contourfm(data)
title('Temperature at 2m (' + t.strftime('%Y-%m-%d %Hh') + ')')
colorbar(layer)
The result figure from above script:
Dimension range can also be given by min/max indexes, or by exactly min/max longitude/latitude (only for lonlat projection data).
Code: Select all
#Set dimension range by indexes
data = f['T02M'][tidx,lidx,80:100,20:50]
#Set dimension range by lon/lat
data = f['T02M'][tidx,lidx,[-10,10],[20,50]]
The result figure from above script:
'tostation' function was used to extract the data at specific location.
Code: Select all
f = addfile('D:/Temp/arl/gdas1.jul09.w5')
tidx = 0
t = f.gettime(tidx)
lidx = 0
data = f['T02M'][tidx,lidx,[25,35],[100,110]]
lon = 104.15
lat = 30.01
d = data.tostation(lon, lat)
print d