爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 21054|回复: 3

画中国地形出现问题,求助

[复制链接]

新浪微博达人勋

发表于 2021-3-2 21:34:53 | 显示全部楼层 |阅读模式
5金钱
本帖最后由 HANSEN 于 2021-3-2 21:37 编辑

需要画只有中国国内的地形的地图,在家园上看到有人用MI提取了国内的地形数据,但是我在使用NCL读数据画图的时候,出现以下报错,height是已提取的国内地形数据变量,想请教一下各位大佬,这是怎么回事呢?这个height变量是带了coordinates的 为啥说画图说没有坐标信息

Variable: height
Type: short
Total Size: 4830422 bytes
            2415211 values
Number of Dimensions: 2
Dimensions and sizes:   [lat | 1201] x [lon | 2011]
Coordinates:
            lat: [15..55]
            lon: [70..137]
Number Of Attributes: 3
  long_name :   Longitude
  units :       degrees_east
  name :        z
(0)     check_for_y_lat_coord: Warning: Data either does not contain
(0)     a valid latitude coordinate array or doesn't contain one at all.
(0)     A valid latitude coordinate array should have a 'units'
(0)     attribute equal to one of the following values:
(0)         'degrees_north' 'degrees-north' 'degree_north' 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
(0)     check_for_lon_coord: Warning: Data either does not contain
(0)     a valid longitude coordinate array or doesn't contain one at all.
(0)     A valid longitude coordinate array should have a 'units'
(0)     attribute equal to one of the following values:
(0)         'degrees_east' 'degrees-east' 'degree_east' 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'

这个是家园大佬画的图

这个是家园大佬画的图

这个是我的程序报错

这个是我的程序报错
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2021-3-2 21:39:09 | 显示全部楼层
我的脚本如下

begin
filepath1     = "./topo_cn.nc"
    f1            = addfile(filepath1, "r")
    height        = f1->z
    wks  = gsn_open_wks("png", "topo_cn")
    res                 = True
    res@gsnDraw         = False
    res@gsnFrame        = False
    ;res@gsnMaximize     = True
    ;res@vpWidthF        = 0.6
    ;res@vpHeightF       = 0.25
    res@cnLinesOn       = False
    res@cnInfoLabelOn   = False
    res@cnLineLabelsOn  = False
    res@cnFillOn        = True
    res@cnFillPalette   = "MPL_Greys";"precip3_16lev"
    res@gsnAddCyclic    = False
    ;res@cnFillMode      = "RasterFill";"CellFill";
    ;set for map
    res@mpOutlineBoundarySets   = "NoBoundaries"
    res@mpDataSetName           = "Earth..4"
    res@mpAreaMaskingOn         = True
    res@mpMaskAreaSpecifiers    = (/"China","Taiwan","Disputed area between India and China","India:Arunachal Pradesh"/)
    res@mpDataBaseVersion       = "MediumRes"
    ;res@pmLegendDisplayMode     = "Always"
    res@pmTickMarkDisplayMode   = "Always"
   
    res@mpMinLatF               = 15                        
    res@mpMaxLatF               = 55
    res@mpMinLonF               = 70
    res@mpMaxLonF               = 137
   
    res@mpFillOn                      = True
    res@mpLandFillColor               = 0
    res@mpOceanFillColor              = 0
    res@mpInlandWaterFillColor        = 0
    res@cnLevelSelectionMode          = "ExplicitLevels";"AutomaticLevels"
    res@cnLevels                      = (/0,200,500,800,1200,1600,2000,2500,3000/)
    res@cnLabelBarEndStyle            = "ExcludeOuterBoxes"
    ; res@cnLevelSelectionMode          = "ManualLevels "
    ; res@cnMinLevelValF                = -500
    ; res@cnMaxLevelValF                = 2000
    ; res@cnLevelSpacingF               = 500
    res@gsnLeftString                 = ""
    res@gsnRightString                = ""
    res@lbLabelBarOn                  = False
    ; res@tiMainFontHeightF             = 0.015
    ; res@tiMainFontThicknessF          = 2
    res@lbOrientation                 = "vertical"
    res@lbTitlePosition               = "Bottom"
    res@lbTitleString                 = ""
    res@lbTitleFontHeightF            = 0.015
    res@lbLabelFontHeightF            = 0.015
    res@pmLabelBarParallelPosF        = 0.4
    ;res@lbBoxSeparatorLinesOn         = False
    ;res@lbBoxLineColor                = "grey"
    res@pmLabelBarHeightF             = 0.8
    res@pmLabelBarWidthF              = 0.1
    res@lbLabelStride                 = 5

    res@tmXBOn       = True
    res@tmXBLabelsOn = True
    res@tmXTOn       = False
    res@tmXTLabelsOn = False
    res@tmYROn       = False
    res@tmYRLabelsOn = False
    res@tmYLOn       = False
    res@tmYLLabelsOn = False

    plot = gsn_csm_contour_map(wks, height, res)
    draw(plot)   
    frame(wks)

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

使用道具 举报

新浪微博达人勋

发表于 2021-5-15 10:03:27 | 显示全部楼层
赋值给他就好了
lat=f1->y
lat@units="degrees_north"
lon=f1->x
lon@units="degrees_east"
height!0="lat"
height&lat=lat
height!1="lon"
height&lon=lon
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

发表于 2022-5-11 15:30:47 | 显示全部楼层
上下两个height不一样,给坐标变量赋值单位啥的就好了
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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