Read and plot bdyfiles

Post Reply
yaqiang
Posts: 51
Joined: October 5th, 2015, 10:20 pm
Registered HYSPLIT User: Yes

Read and plot bdyfiles

Post by yaqiang » January 10th, 2020, 1:05 am

The HYSPLIT ./bdyfiles subdirectory contains ascii gridded terrain, land-use and roughness length data for Hysplit. Following is an example MeteoInfoLab script for reading and plotting terrain data file.

Code: Select all

#Read and plot HYSPLIT bdyfiles

import re

#Parameters
slat = -90    #lat of lower left corner
slon = -180   #lon of lower left corner
nlat = 180    #lat number of data points
nlon = 360    #lon number of data points
dlat = 1      #lat spacing in degrees between data points
dlon = 1      #lon spacing in degrees between data points
slat = slat + dlat * 0.5  #from corner to center
slon = slon + dlon * 0.5
lat = arange1(slat, nlat, dlat)
lon = arange1(slon, nlon, dlon)

#Read data
fn = 'C:/hysplit4/bdyfiles/TERRAIN.ASC'
f = open(fn)
data = zeros((nlat, nlon))
i = nlat - 1
for line in f:
    d = re.findall(r'.{4}', line)
    data[i,:] = array(d).astype('float')
    i -= 1

#Plot
axesm()
geoshow('country', edgecolor='k')
levs = arange(0, 6000, 200)
layer = imshowm(lon, lat, data, levs, cmap='MPL_terrain')
colorbar(layer)
title('Terrain')
bdy_terrain.png

Post Reply