爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5476|回复: 1

[作图] 有点困惑在数据处理上

[复制链接]

新浪微博达人勋

发表于 2014-8-14 15:41:00 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 刘哲 于 2014-8-14 15:43 编辑

数据描述:
float UGRD_P0_L100_GLL0 ( lv_ISBL0, lat_0, lon_0 )
         center :       US National Weather Service - NCEP (WMC)
         production_status :    Operational products
         long_name :    U-component of wind
         units :        m s-1
         _FillValue :   1e+20
         grid_type :    Latitude/longitude
         parameter_discipline_and_category :    Meteorological products, Momentum
         parameter_template_discipline_category_number :        ( 0, 0, 2, 2 )
         level_type :   Isobaric surface (Pa)
         forecast_time :        0
         forecast_time_units :  hours
         initial_time : 04/11/2011 (00:00) // 一共有四个这样的文件,只是不同时段
代码1:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
;read the data
diri = "/home/liuzhe/fnl_data/"
fils = systemfunc("ls "+diri + "fnl_20110411*.grib2")
f = addfiles(fils,"r")
ListSetType(f ,"join")
u = f[:]->UGRD_P0_L100_GLL0
u!2 = "lat"
u&lat = f[0]->UGRD_P0_L100_GLL0&lat_0
print(u&lat)
end

输出结果1(黑底白字)
代码2 :
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
;read the data
diri = "/home/liuzhe/fnl_data/"
fils = systemfunc("ls "+diri + "fnl_20110411*.grib2")
f = addfiles(fils,"r")
ListSetType(f ,"join")
u = f[:]->UGRD_P0_L100_GLL0
print(u(0,0,:,0))
end

输出结果图片2 白底白字
问题: 为什么我都是输出u的第三维的数值,却结果不一样,我的理解是,第1组代码只是把数组的下标换成了-90到90, 第二组代码指的是0-180 所对应的数值,,还有一个 u&lat = f[0]->UGRD_P0_L100_GLL0&lat_0 ,这里的f[0]是什么意思,f本来是一个四维坐标,为什么只出现了f[0],其他三维呢?请大家帮解答一下我的疑惑
1.png
2.png
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-8-14 16:09:55 | 显示全部楼层
从你的描述来看,楼主对数组“下标”和“坐标”的概念有些模糊,两者是有一定区别的。建议楼主仔细阅读以下链接里面的内容:
http://www.ncl.ucar.edu/Document ... s.shtml#Coordinates
http://www.ncl.ucar.edu/Document ... es.shtml#Subscripts

addfiles的返回值从来就不可能是以个四维数组,而是以个list类型的变量。建议楼主仔细阅读addfiles帮助里面的description部分,以及里面提供的例子:
http://www.ncl.ucar.edu/Document ... t-in/addfiles.shtml
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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