- 积分
- 6329
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2015-11-12
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
本帖最后由 liuxiaoyue 于 2019-7-26 10:50 编辑
直接上代码,以2017年10月8日20时海平面气压场(附件)为例。
begin
; read data
lines = asciiread("17100820.000",-1,"string")
delim = " "
print("header:")
print(lines(1:3))
; coordinate information
dlon = tofloat(str_get_field(lines(2),1,delim))
dlat = -tofloat(str_get_field(lines(2),2,delim))
nlon = toint(str_get_field(lines(3),1,delim))
nlat = toint(str_get_field(lines(3),2,delim))
minlon = toint(str_get_field(lines(2),3,delim))
maxlon = toint(str_get_field(lines(2),4,delim))
minlat = toint(str_get_field(lines(2),6,delim))
maxlat = toint(str_get_field(lines(2),5,delim))
print("dlon = " + dlon + "; dlat = " + dlat)
print("nlon = " + nlon + "; nlat = " + nlat)
print("minlon = " + minlon + "; maxlon = " + maxlon)
print("minlat = " + minlat + "; maxlat = " + maxlat)
lat = fspan(maxlat, minlat, nlat)
lat@units = "degrees_north"
lon = fspan(minlon, maxlon, nlon)
lon@units = "degrees_east"
; prepare array
p0 = new((/dimsizes(lat),dimsizes(lon)/), float)
p0!0 = "lat"
p0&lat = lat
p0!1 = "lon"
p0&lon = lon
; convert
do i = 0, nlat-1
n = 8*i+4
p0(i,{ispan(minlon, maxlon, 10)}) = tofloat(str_get_field(lines(n:n+7),1,delim))
do j = 1, 9
p0(i,{ispan(minlon+j, maxlon-10+j, 10)}) = tofloat(str_get_field(lines(n:n+6),j+1,delim))
end do
end do
; output
system("/bin/rm -f p0.17100820.nc")
ncdf = addfile("p0.17100820.nc","c")
ncdf->p0 = p0
end
|
-
-
MICAPS文件
-
-
17100820.000
20.09 KB, 下载次数: 104, 下载积分: 金钱 -5
micaps第四类数据
|