爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 11760|回复: 2

[作图] 图形偏移后的坐标固定

[复制链接]
发表于 2019-7-3 17:47:41 | 显示全部楼层 |阅读模式
1金钱
我用ncl画图时出现底图和实际图形的坐标偏移,同学说可能是坐标没有固定,要重新设置坐标,于是修改后的部分程序如下:
;**********************************************************************
; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
;-----------------读取数据-----------------------------   
  f = addfile("./mfwamglocep_2017010300_R20170104.nc","r");读取nc文件
  lon = f->longitude(0:4319)
  lon@units = "degrees_east"
  lat = f->latitude(0:2040)
  lat@units = "degrees_north"
  H = f->VHM0(0,0:2040,0:4319) ;取nc变量赋值
  H!0="lat"
  H&lat = lat
  H!1="lon"
  H&lon = lon
  wtype          = "png"
  wks1 = gsn_open_wks(wtype,"swh")

可是出现了报错:
(0) check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all.
(0) A valid latitude coordinate array should have a 'units' 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 a valid longitude coordinate array or doesn't contain one at all.
(0) A valid longitude coordinate array should have a 'units' 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'


我不理解为什么我已经设置坐标单位还会这样报错?而且图依旧是偏移的没有改进,应该怎么才能解决偏移的问题呢?麻烦大家帮忙看看

swh.png
密码修改失败请联系微信:mofangbao
发表于 2019-7-4 08:37:26 | 显示全部楼层
   要不你把提取出来的lat和lon打印出来,检查一下坐标数组是不是有问题。
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

发表于 2022-3-7 13:27:02 | 显示全部楼层
请问你解决了这个问题嘛,遇到了类似的问题不知道怎么改TT
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

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

本版积分规则

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

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

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