爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
楼主: xuebiz

[其他] [求助]【已解决】NCL地图坐标设置问题

[复制链接]
 楼主| 发表于 2016-4-5 15:05:55 | 显示全部楼层

warning:Attempt to reference attribute (scale_factor) which is undefined
warning:Attempt to reference attribute (add_offset) which is undefined

为什么提示我这个,nc文件里有定义的啊。。。

还有这几个错,nc文件里也有标啊。。。


(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'
密码修改失败请联系微信:mofangbao
发表于 2016-4-5 15:44:37 | 显示全部楼层
你应该是tarr没定义吧,在前面加个tarr=temp,完了再tatt=temp*temp那什么的,给它attribute和coordinate应该就可以
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2016-4-6 12:25:49 | 显示全部楼层
centaurus 发表于 2016-4-5 15:44
你应该是tarr没定义吧,在前面加个tarr=temp,完了再tatt=temp*temp那什么的,给它attribute和coordinate应 ...

给它attribute和coordinate应该就可以

这个听不懂
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2016-4-6 15:10:31 | 显示全部楼层
本帖最后由 xuebiz 于 2016-4-7 10:55 编辑

执行 temp = temp * temp@scale_factor + temp@add_offset总是报错:

warning:Attempt to reference attribute (scale_factor) which is undefined
warning:Attempt to reference attribute (add_offset) which is undefined

--------------------------------------------------------------------------------------------------------------------
(测试的其他一个数据集)这个要怎么破,nc文件里有scale_factor,add_offset
但是 temp = short2flt(f->temp(0,:,:))后,printVarSummaery(temp)看不到scale_factor,add_offset
只有:
Variable: temp
Type: float
Total Size: 4147200 bytes
            1036800 values
Number of Dimensions: 2
Dimensions and sizes:    [lat | 720] x [lon | 1440]
Coordinates:
            lat: [-89.875..89.875]
            lon: [0.125..359.875]
Number Of Attributes: 7
  long_name :   temperature
  units :    deg Celsius
  _FillValue_original :    32767
  _FillValue :    32767
  missing_value_original :    32767
  missing_value :    32767
----------------------------
nc文件里:
    short temp(time, lat, lon) ;
        temp:long_name = "temperature" ;
        temp:units = "deg Celsius" ;
        temp:missing_value = 32767s ;
        temp:sea_ice = 32766s ;
        temp:scale_factor = 0.1f ;
        temp:add_offset = 0s ;
----------------------------------------------------------------------------------------------------------
已解决,原来它自动给算了temp = temp * temp@scale_factor + temp@add_offset
自己白费力气,~~~~(>_<)~~~~还过错了数值

密码修改失败请联系微信:mofangbao
发表于 2016-6-28 17:12:03 | 显示全部楼层
有时出现这个问题可能是因为变量存放维数的顺序问题,应为(lat,lon),而不是(lon,lat)
密码修改失败请联系微信:mofangbao
发表于 2016-12-13 12:44:08 | 显示全部楼层
请问楼主地图与等值线不匹配的问题是怎么解决的呀?
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2016-12-16 08:29:57 | 显示全部楼层
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

begin

  fc = addfile("../data/ABC.nc", "r")

  wks = gsn_open_wks("png","temp_t0d0")

  gsn_define_colormap(wks,"rainbow")

lon = fc->lon(0:719)
  lon@units = "degrees_east"
  lat = fc->lat(0:359)
  lat@units = "degrees_north"

  temp = short2flt(fc->tz_h(0,0,0:359,0:719))

  res = True
  res@gsnAddCyclic=False
  res@mpMinLonF = 0.25
  res@mpMaxLonF = 359.75
  res@mpMinLatF = -89.75
  res@mpMaxLatF = 89.75
  res@mpCenterLonF = 180.

  res@cnFillOn    = True                        ; turn on color fill
  res@cnLinesOn   = False                       ; turn off the contour lines
  res@cnLineLabelsOn = False                    ; turn the line labels off
  res@cnInfoLabelOn = False   
  res@gsnRightString = "Temperature "
  res@gsnLeftString = ""

  plot = gsn_csm_contour_map(wks, temp, res)
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2016-12-16 08:30:34 | 显示全部楼层
qizyq 发表于 2016-12-13 12:44
请问楼主地图与等值线不匹配的问题是怎么解决的呀?
自己定义经纬度范围,代码如上
密码修改失败请联系微信:mofangbao
发表于 2018-4-13 20:34:48 | 显示全部楼层
楼主啊,你这个错误最后是怎么解决的呢?遇到了相同的问题!求助啊
密码修改失败请联系微信:mofangbao
发表于 2019-11-12 21:48:13 | 显示全部楼层
遇到了相同的问题,与楼主解决方式不同,最后发现是因为我在画等值线的函数中直接把变量乘了1000(单位转换),进行计算后属性会消失,与我类似情况的可以作为参考检查下,找问题找不到的感觉着实难受。
密码修改失败请联系微信:mofangbao
回复 支持 1 反对 0

使用道具 举报

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

本版积分规则

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

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

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