爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 6608|回复: 3

[作图] 请问NCL如何关闭坐标轴

[复制链接]
发表于 2016-8-11 09:32:10 | 显示全部楼层 |阅读模式

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

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

x
请问如何关闭坐标轴啊?我已经使用了mpres@pmTickMarkDisplayMode="Never" 但是没有效果

程序如下:
load "$WORKDIR/include/library.ncl"
undef ("setProperty")
procedure setProperty(olon, olat)
begin
    olon!0          = "lon"
    olon@long_name  = "lon"
    olon@units      = "degrees-east"
    olon&lon        = olon

    olat!0          = "lat"
    olat@long_name  = "lat"
    olat@units      = "degrees_north"
    olat&lat        = olat
end

;数据赋坐标
undef ("setCoordinate")
procedure setCoordinate(data,lon,lat)
begin
    data!0          = "lat"
    data&lat        = lat1

    data!1          = "lon"
    data&lon        = lon1              
end

begin
    system("date")
    configFile="$WORKDIR/config/h8sat.config"
    ;读取命令行参数字符串数组
    inputfileName = getArgsPara(params,"inputfileName")
;=================================================读取配置文件=====================================
    x0 = stringtofloat(readParamInfo(configFile,"X0"))
    x1 = stringtofloat(readParamInfo(configFile,"X1"))
    y0   = stringtofloat(readParamInfo(configFile,"Y0"))
    y1  = stringtofloat(readParamInfo(configFile,"Y1"))   ;A reference longitude and latitude
    ;图片大小
    imgWidth=stringtointeger(readParamInfo(configFile,"IMGWIDTH"))
    imgHeight=stringtointeger(readParamInfo(configFile,"IMGHEIGHT"))
    ;早晚时间配置
    dayHour=stringtointeger(readParamInfo(configFile,"DAYHOUR"))
    nightHour=stringtointeger(readParamInfo(configFile,"NIGHTHOUR"))

    arr=(/333,666,9999/)
    narr=dimsizes(arr)
    ;diri = "/home/zx/test/"
    ;params = systemfunc ("ls "+ diri + "HS_H08_20160801_0850_B14_TURB_R20.txt")

    data = asciiread(inputfileName, (/2066,3/), "float")
    data@_FillValue=-9999
    IRnums=dimsizes(data)
    lon    = data(4:2065,1)                  
    lat    = data(4:2065,2)
    setProperty(lon, lat)
     lat_new=new((/narr+1,dimsizes(lat)/), float)
     lon_new=new((/narr+1,dimsizes(lon)/), float)

     height = data(4:2065,0)
     ;print (height)
   do i=0,narr
        if (i.eq.0) then
            indexes=ind(height.lt.arr(0))
        end if

        if (i.eq.narr) then
            indexes=ind(height.ge.arr(2))
        end if

        if (i.gt.0.and.i.lt.narr) then
            indexes=ind(height.ge.arr(i-1).and.height.lt.arr(i))
        end if
        if(all(ismissing(indexes))) then

            delete(indexes)
            continue
        end if
    npts_range=dimsizes(indexes)
    ;print (indexes)
    lat_new(i,0:npts_range-1)=lat(indexes)
    lon_new(i,0:npts_range-1)=lon(indexes)
    delete(indexes)
    end do

    ;==================begin plot==================================
    filePart=str_split(inputfileName,"/")
    fileName=filePart(dimsizes(filePart)-1)
    splitName=str_split(fileName,".")

    splitPart=str_split(splitName(0),"_")
    strtime=splitPart(2)                                ;日期
    strhour=str_get_cols(splitPart(3),0,1)              ;时间
    strmin=str_get_cols(splitPart(3),2,3)               
    outputPath="$PRODUCTDIR"+"/"+strtime+"/Turbu"
    checkOrCreateDir(outputPath)
    outputfileName=str_sub_str(splitName(0),splitPart(4),"Turbu")+"_NJ"
    wks=gsn_open_wks("png",outputPath+"/"+outputfileName)
    mpres=True
     mpres@vpXF                      = 0.0
    mpres@vpYF                      = 1.0
    ; 调节矩形的长宽
    mpres@vpWidthF                  = 1.0
    mpres@vpHeightF                 = 1.0

    mpres@gsnFrame=False
    mpres@gsnDraw=False
    mpres@mpMinLatF=min(lat)
    mpres@mpMaxLatF=max(lat)
    mpres@mpMinLonF=min(lon)
    mpres@mpMaxLonF=max(lon)

    ;mpres@tmXBLabelFontHeightF=0.012
    ;mpres@tmYLLabelFontHeightF=0.012


    mpres@pmTickMarkDisplayMode="Never"

    mpres@mpFillOn = False
    mpres@mpOutlineOn = False
    ;mpres@mpFillColors = "background"
    map=gsn_csm_map(wks, mpres)

    gsres=True
    gsres@sfXArray=lon
    gsres@sfYArray=lat
    gsres@cnRasterSmoothingOn = True
    gsres@cnSmoothingDistanceF =True
    gsres@cnSmoothingOn=True
    gsres@cnSmoothingTensionF=True
    gsres@gsMarkerIndex=NhlNewMarker(wks, "y", 35, 0.0, 0.0, 1.0, 0.2, 0.0)

      colors = (/(/255,255,255/),(/0,0,0/),(/0,0,0/),(/0,0,0/)/)*1.0
     cmap = colors/255.
     gsn_define_colormap(wks,cmap)
    getvalues wks
    "wkColorMapLen":clen
    end getvalues

    nstep=(clen-2)/narr
    colorss=ispan(2, 5, 1)

    do j=0,narr
        gsres@gsMarkerColor=colorss(j)
        dumstr=unique_string("marker")
        map@$dumstr$=gsn_add_polymarker(wks, map, lon_new(j,:), lat_new(j,:), gsres)
    end do
    draw(map)
    frame(wks)  
    cmd="convert -transparent white "+outputPath+"/"+outputfileName+".png"+" "+outputPath+"/"+outputfileName+"_T.png"
    system(cmd)

end

如图

如图
密码修改失败请联系微信:mofangbao
发表于 2016-8-11 12:37:13 | 显示全部楼层
res@tmXBMode = False
res@tmYLMode = False
密码修改失败请联系微信:mofangbao
发表于 2016-8-11 13:36:30 | 显示全部楼层
res@tmXBOn = False
res@tmXTOn = False
密码修改失败请联系微信:mofangbao
发表于 2019-5-29 16:46:47 | 显示全部楼层
{:eb302:}{:eb302:}{:eb302:}{:eb302:}{:eb302:}{:eb302:}
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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