爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 8974|回复: 10

台风路径图

[复制链接]

新浪微博达人勋

发表于 2014-11-13 21:56:30 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
                用ncl画台风路径图,wrf官网上的Katrina飓风可以画出,在用自己的数据进行画图时,模拟情况可以画出,但是besttrack做不出来,大家帮忙看看。下面是我的文件:
besttrack:
06 GMT 09/22/14  26.9N  122.0E   28       982      Tropical Storm
07 GMT 09/22/14  27.1N  122.0E   28       982      Tropical Storm
08 GMT 09/22/14  27.3N  121.9E   25       985      Tropical Storm
09 GMT 09/22/14  27.5N  121.9E   25       985      Tropical Storm
10 GMT 09/22/14  27.6N  121.9E   25       985      Tropical Storm
11 GMT 09/22/14  27.8N  121.9E   25       985      Tropical Storm
12 GMT 09/22/14  28.0N  121.9E   25       985      Tropical Storm
13 GMT 09/22/14  28.1N  121.9E   25       985      Tropical Storm
14 GMT 09/22/14  28.3N  121.9E   25       985      Tropical Storm
15 GMT 09/22/14  28.4N  121.9E   25       985      Tropical Storm
16 GMT 09/22/14  28.5N  121.9E   25       985      Tropical Storm
17 GMT 09/22/14  28.6N  121.9E   28       985      Tropical Storm
18 GMT 09/22/14  28.7N  121.9E   28       985      Tropical Storm
19 GMT 09/22/14  28.9N  121.9E   28       985      Tropical Storm
20 GMT 09/22/14  29.1N  122.0E   28       985      Tropical Storm
21 GMT 09/22/14  29.1N  122.0E   28       985      Tropical Storm
22 GMT 09/22/14  29.3N  122.0E   28       985      Tropical Storm
23 GMT 09/22/14  29.4N  121.9E   28       985      Tropical Storm
00 GMT 09/23/14  29.5N  121.9E   28       985      Tropical Storm
01 GMT 09/23/14  29.6N  121.8E   28       985      Tropical Storm
02 GMT 09/23/14  29.7N  121.8E   28       985      Tropical Storm
03 GMT 09/23/14  29.9N  121.8E   28       985      Tropical Storm
04 GMT 09/23/14  30.0N  121.7E   28       985      Tropical Storm
05 GMT 09/23/14  30.2N  121.6E   28       985      Tropical Storm
06 GMT 09/23/14  30.4N  121.5E   25       988      Tropical Storm
07 GMT 09/23/14  30.4N  121.5E   25       988      Tropical Storm
08 GMT 09/23/14  30.5N  121.5E   25       988      Tropical Storm
09 GMT 09/23/14  30.6N  121.5E   23       990      Tropical Storm
10 GMT 09/23/14  30.7N  121.7E   23       990      Tropical Storm
11 GMT 09/23/14  30.9N  121.7E   23       990      Tropical Storm
12 GMT 09/23/14  31.1N  121.7E   23       990      Tropical Storm
13 GMT 09/23/14  31.2N  121.6E   23       990      Tropical Storm
14 GMT 09/23/14  31.3N  121.5E   20       995      Tropical Storm
15 GMT 09/23/14  31.5N  121.6E   20       995      Tropical Storm
16 GMT 09/23/14  31.5N  121.7E   20       995      Tropical Storm
17 GMT 09/23/14  31.6N  121.8E   20       995      Tropical Storm
18 GMT 09/23/14  31.6N  121.8E   20       995      Tropical Storm
19 GMT 09/23/14  31.8N  122.0E   20       995      Tropical Storm
20 GMT 09/23/14  32.0N  122.2E   20       995      Tropical Storm
21 GMT 09/23/14  32.2N  122.4E   20       995      Tropical Storm
22 GMT 09/23/14  32.4N  122.7E   20       995      Tropical Storm
23 GMT 09/23/14  32.6N  123.0E   20       995      Tropical Storm
00 GMT 09/24/14  32.6N  123.1E   20       995      Tropical Storm
01 GMT 09/24/14  32.7N  123.3E   18       998      Tropical Storm
02 GMT 09/24/14  32.8N  123.8E   18       998      Tropical Storm
03 GMT 09/24/14  32.9N  124.2E   18       998      Tropical Storm
04 GMT 09/24/14  33.1N  124.6E   18       998      Tropical Storm
05 GMT 09/24/14  33.2N  124.8E   18       998      Tropical Storm
06 GMT 09/24/14  33.2N  124.9E   18       998      Tropical Storm
07 GMT 09/24/14  33.2N  125.0E   18       998      Tropical Storm
08 GMT 09/24/14  33.2N  125.1E   18       998      Tropical Storm
09 GMT 09/24/14  33.3N  125.3E   18       998      Tropical Storm
10 GMT 09/24/14  33.4N  125.6E   18       998      Tropical Storm


设置ncl文件:
; Plot best track if asked for
; currently only a standard plot, but this can be changed

undef("PlotBestTrack")
procedure PlotBestTrack(wks,map,tkres)
begin

    print("Now attempting to plot bestTRACK from data file " + tkres@btFILE)

    lat  = stringtofloat(systemfunc("cut -c18-21 " + tkres@btFILE))
    latsign  = systemfunc("cut -c22-22 " + tkres@btFILE)
    lon  = stringtofloat(systemfunc("cut -c25-29 " + tkres@btFILE))
    lonsign  = systemfunc("cut -c30-30 " + tkres@btFILE)
    bthh  = systemfunc("cut -c1-2 " + tkres@btFILE)
    btdd  = systemfunc("cut -c11-12 " + tkres@btFILE)
    btdate = btdd + "/" + bthh
    btcat = stringtoint(systemfunc("cut -c34-36 " + tkres@btFILE))

    ; Ckect to see if we have S/N ; W/E data
    checkDATA = 0
    do isign=0,dimsizes(lat)-1
       if (latsign(isign) .eq. "S") then
         lat(isign) = -1.0 * lat(isign)
       else
         if (latsign(isign) .ne. "N") then
           checkDATA = checkDATA + 1
         end if
       end if
       if (lonsign(isign) .eq. "W") then
         lon(isign) = -1.0 * lon(isign)
       else
         if (lonsign(isign) .ne. "E") then
           checkDATA = checkDATA + 1
         end if
       end if
    end do
    if ( checkDATA .gt. 0 ) then
       print("###########################################################")
       print("Looks like some of your best TRACK data is not in columns.")
       print("Please ensure all data is in columns and re-run the script.")
       print("###########################################################")
    end if


    lnres = True
    lnres@gsLineThicknessF = 2.6
    do i=0,dimsizes(lat)-2
         lnres@gsLineColor    = tkres@btCOLOR
      ;if ( lon(i) .lt. 135 ) then
         gsn_polyline(wks,map,(/lon(i),lon(i+1)/),(/lat(i),lat(i+1)/),lnres)
      ;end if
    end do

    print("   We have " + dimsizes(lat) + " data points")
    print("   Track start point (lon/lat) = "+ lon(0) +" "+ lat(0))
    print("   Track end point (lon/lat)   = "+ lon(dimsizes(lat)-1) +" "+ lat(dimsizes(lat)-1))

    txres2               = True
    txres2@txFont        = "helvetica-bold"
    txres2@txFontHeightF = 0.008
    txres2@txJust        = "CenterLeft"
    txres2@txAngleF        = 45.00   
    lnres2                  = True
    lnres2@gsLineColor      = "Black"
    lnres2@gsLineThicknessF = 0.7
    pmres = True
    pmres@gsMarkerIndex = create_hurricane_symbol(wks)
    do i=0,dimsizes(lat)-1
      pmres@gsMarkerColor = "Black"
      pmres@gsMarkerIndex = 16
      pmres@gsMarkerSizeF = 0.005
      if (btcat(i) .ge. 40) then
        pmres@gsMarkerColor = 5
      end if
      if (btcat(i) .ge. 52) then
        pmres@gsMarkerColor = 6
      end if
      if (btcat(i) .ge. 60) then
        pmres@gsMarkerColor = 7
      end if
      if (btcat(i) .ge. 71) then
        pmres@gsMarkerColor = 8
      end if
      if (btcat(i) .ge. 84) then
        pmres@gsMarkerColor = 9
      end if

      if (btcat(i) .ge. 40) then
        pmres@gsMarkerIndex = create_hurricane_symbol(wks)
        pmres@gsMarkerSizeF = 0.01
      end if

      gsn_polyline(wks,map,(/lon(i),lon(i)+1.0/),(/lat(i),lat(i)+1.0/),lnres2)
      gsn_polymarker(wks,map,lon(i)+1.0,lat(i)+1.0,pmres)
      if ( bthh(i) .eq. "03" )then
        gsn_text(wks,map,btdate(i),lon(i)+1.2,lat(i)+1.2,txres2)
      end if

    end do  

end



运行结果是:
warning:stringtofloat: a bad value was passed; input strings must contain numeric digits, replacing with missing value
warning:stringtofloat: a bad value was passed; input strings must contain numeric digits, replacing with missing value
warning:stringtofloat: a bad value was passed; input strings must contain numeric digits, replacing with missing value
warning:stringtofloat: a bad value was passed; input strings must contain numeric digits, replacing with missing value
warning:stringtointeger: a bad value was passed; input strings must contain numeric digits, replacing with missing value
warning:stringtointeger: a bad value was passed; input strings must contain numeric digits, replacing with missing value
(0)    ###########################################################
(0)    Looks like some of your best TRACK data is not in columns.
(0)    Please ensure all data is in columns and re-run the script.
(0)    ###########################################################
fatal:Subscript out of range, error in subscript #0
fatal:An error occurred reading xf
fatal:["Execute.c":8567]:Execute: Error occurred at or near line 4363 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl

fatal:["Execute.c":8567]:Execute: Error occurred at or near line 4528 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl

fatal:["Execute.c":8567]:Execute: Error occurred at or near line 604 in file CreateTracks1.ncl

fatal:["Execute.c":8567]:Execute: Error occurred at or near line 1311 in file CreateTracks1.ncl


密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-11-14 09:49:29 | 显示全部楼层
前面那几行警告,就是你做不出来的原因了。
检查读取代码:
    lat  = stringtofloat(systemfunc("cut -c18-21 " + tkres@btFILE))
     latsign  = systemfunc("cut -c22-22 " + tkres@btFILE)
     lon  = stringtofloat(systemfunc("cut -c25-29 " + tkres@btFILE))
     lonsign  = systemfunc("cut -c30-30 " + tkres@btFILE)
     bthh  = systemfunc("cut -c1-2 " + tkres@btFILE)
     btdd  = systemfunc("cut -c11-12 " + tkres@btFILE)
     btdate = btdd + "/" + bthh
     btcat = stringtoint(systemfunc("cut -c34-36 " + tkres@btFILE))
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-11-14 19:53:52 | 显示全部楼层
风子 发表于 2014-11-14 09:49
前面那几行警告,就是你做不出来的原因了。
检查读取代码:
    lat  = stringtofloat(systemfunc("cut - ...

我检查了好多遍,但都是说出错啊,不知道为什么?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-11-14 21:39:17 | 显示全部楼层
debug。
不断注释掉可能出错的地方以寻找警告的来源。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-11-14 22:52:03 | 显示全部楼层
风子 发表于 2014-11-14 21:39
debug。
不断注释掉可能出错的地方以寻找警告的来源。

还没用过debug,具体说一下怎么用吗?谢谢。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-11-15 12:40:49 | 显示全部楼层
renjia 发表于 2014-11-14 22:52
还没用过debug,具体说一下怎么用吗?谢谢。

就是自己通过注释来查错。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-11-15 12:44:25 | 显示全部楼层
你为什么不用这两个函数 asciiread  str_get_field来读,这个很方便。
data = asciiread(file1, -1, "string")
  delim="         " ;分隔符 空格和制表符都是有效的。
  YYYYMMDD = str_get_field(data, 1, delim) ;获取字符串的一列子字符串
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-11-15 20:09:27 | 显示全部楼层
0708011 发表于 2014-11-15 12:44
你为什么不用这两个函数 asciiread  str_get_field来读,这个很方便。
data = asciiread(file1, -1, "str ...

非常感谢,我试试
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2015-1-2 21:51:16 | 显示全部楼层
学习学习
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

发表于 2015-10-21 16:16:24 | 显示全部楼层
debug要怎么用呢
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表