爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4431|回复: 2

[作图] 数据是txt格式的,数据内容是一个domain各网格的值,这些值只有3类

[复制链接]

新浪微博达人勋

发表于 2016-7-27 15:50:25 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 ljlhx2016 于 2016-7-28 19:40 编辑

数据是txt格式的,数据内容是一个domain各网格的值,这些值只有3类:111、121、-9999。一共3000*5000个网格。
对应的经纬度可以算出来,怎么把这3类值在这个domain上面画出来,求大神指导  代码如下:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin

  fil = "~/mine/data/irriland.txt"
  head = readAsciiHead(fil,6)
  print(head)
  nlon = 6157
  nlat = 3393
  xllcorner = 66.292299724777
  yllcorner = 14.996703348654
  cellsize  = 0.011783626620396
  clon = 103.0
  clat = 35.0
  NODATA_value = -9999
  data = readAsciiTable(fil,nlon,"float",(/6,0/))
  printVarSummary(data)
  lucc = data(::-1,:)                            ; flip the data in latitude if needed

  lat = fspan(yllcorner,yllcorner + 3392 * cellsize,3393)
  lon = fspan(xllcorner,xllcorner + 6156 * cellsize,6157)
  lat2 = onedtond(lat,(/6157,3393/))
  lon2 = onedtond(lon,(/3393,6157/))
;  lat2@units = "degrees_north"
;  lon2@units = "degrees_east"

  wks = gsn_open_wks("x11","~/irriland")

  res = True
  res@cnFillOn = True
;  res@cnLevelSelectionMode = "ExplicitLevels"
;  res@cnLevels = (/110,120/)
;  res@cnFillColors = (/"White","Green","Red"/)


  res@pmTickMarkDisplayMode = "Always"
  res@tiMainString = "Cropland of China"
  res@gsnAddCyclic = False

  res@mpProjection = "Stereographic"
  res@mpLimitMode  = "Corners"
  res@mpLeftCornerLatF = lat2(0,0)
  res@mpLeftCornerLonF = lon2(0,0)
  res@mpRightCornerLatF = lat2(nlon-1,nlat-1)
  res@mpRightCornerLonF = lon2(nlat-1,nlon-1)

  res@mpRelativeCenterLon = True
  res@mpCenterLonF        = clon
  res@mpRelativeCenterLat = True
  res@mpCenterLatF        = clat
  res@tfDoNDCOverlay      = True

;---------------Increase the maximum workspace memory----------------
  setvalues NhlGetWorkspaceObjectId()
    "wsMaximumSize" : 600000000
  end setvalues

  plot = gsn_csm_contour_map(wks,lucc,res)

end
这是生成的图片,求大神指导问题出在哪里

生成的图片

生成的图片



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

新浪微博达人勋

 楼主| 发表于 2016-7-28 19:42:50 | 显示全部楼层
自己顶一下,别沉啊
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-7-31 19:59:37 | 显示全部楼层

回帖奖励 +1 金钱

楼主不妨检查一下底图的设置
为什么会出现两个中国地图呢?
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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