爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 16567|回复: 14

关于ListSetType的问题

[复制链接]
发表于 2014-8-7 20:06:03 | 显示全部楼层 |阅读模式

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

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

x
数据格式为:
文件名:fnl_20110411_00_00.grib2
float TMP_P0_L1_GLL0 ( lat_0, lon_0 )
         center :       US National Weather Service - NCEP (WMC)
         production_status :    Operational products
         long_name :    Temperature
         units :        K
         _FillValue :   1e+20
         grid_type :    Latitude/longitude
         parameter_discipline_and_category :    Meteorological products, Temperature
         parameter_template_discipline_category_number :        ( 0, 0, 0, 0 )
         level_type :   Ground or water surface
         level :         0
         forecast_time :        0
         forecast_time_units :  hours
         initial_time : 04/11/2011 (00:00)
语法:
load"$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load"$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
begin
f = addfile("/home/liuzhe/fnl_data/fnl_20110411_00_00.grib2","r")
V = f->TMP_P0_L1_GLL0
print(V)
End
print(V)的结果:
(175,138)       236.8
(175,139)       237
(175,140)       237.3
(175,141)       237.5
(175,142)       237.8
(175,143)       238.1
(175,144)       238.5
(175,145)       239
(175,146)       239.4
(175,147)       239.9
(175,148)       240.4
(175,149)       240.9
(175,150)       241.4
(175,151)       241.9
(175,152)       242.3
(175,153)       242.7
(175,154)       243
(175,155)       243.3
(175,156)       243.6
(175,157)       243.9
(175,158)       244.1
为什么第一维坐标(纬度)会出现175,而纬度的范围是(-90,90),怎嘛会出现175,
我的理解是175代表的不是纬度,而是数组的横坐标。
第二个问题:
文件名: fnl_20110411_00_00.grib2
         fnl_20110411_06_00.grib2
         fnl_20110411_12_00.grib2
         fnl_20110411_18_00.grib2
这四个文件都具有一个元数据(只有initial_time : 04/11/2011 (00:00)(这个时间点不同而已))
loat TMP_P0_L1_GLL0 ( lat_0, lon_0 )
         center :       US National Weather Service - NCEP (WMC)
         production_status :    Operational products
         long_name :    Temperature
         units :        K
         _FillValue :   1e+20
         grid_type :    Latitude/longitude
         parameter_discipline_and_category :    Meteorological products, Temperature
         parameter_template_discipline_category_number :        ( 0, 0, 0, 0 )
         level_type :   Ground or water surface
         level :         0
         forecast_time :        0
         forecast_time_units :  hours
         initial_time : 04/11/2011 (00:00)这个时间点不同而已)
语法:
load"$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load"$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;---Open file and read in data
begin
diri = "/home/liuzhe/fnl_data/"
fils = systemfunc("ls "+diri +"fnl_20110411*.grib2")
f = addfiles(fils,"r")
ListSetType(f, "cat")
V = f[:]->TMP_P0_L1_GLL0
print(V)
End
printVarSummary(V)
Variable: V
Type: float
Total Size: 1042560 bytes
            260640 values
Number of Dimensions: 2
Dimensions and sizes:   [lat_0 | 724] x [lon_0 | 360]
Coordinates:
            lat_0: [90..-90]
            lon_0: [ 0..359]
Number Of Attributes: 13
  center :      US National Weather Service - NCEP (WMC)
  production_status :   Operational products
  long_name :   Temperature
  units :       K
  _FillValue :  1e+20
  grid_type :   Latitude/longitude
  parameter_discipline_and_category :   Meteorological products, Temperature
  parameter_template_discipline_category_number :       ( 0, 0, 0, 0 )
  level_type :  Ground or water surface
  level :        0
  forecast_time :       0
  forecast_time_units : hours
  initial_time :        04/11/2011 (00:00)
Print(v)结果:
(718,125)       229
(718,126)       229.7
(718,127)       230.3
......................................
(718,355)       219.7
(718,356)       219.5
(718,357)       219.3
(718,358)       219.2
(718,359)       219
(719,0) 219.2
(719,1) 219.1
..................................
(723,352)       225.6
(723,353)       225.6
(723,354)       225.6
(723,355)       225.6
(723,356)       225.6
(723,357)       225.6
(723,358)       225.6
(723,359)       225.6
问题:
这个718 是怎嘛来的?是简单将一个文件的数组的左边维数乘以4吗?
这个数组对应的值,感觉与单个文件的数组对应的值,不一样呢?

密码修改失败请联系微信:mofangbao
发表于 2014-8-8 09:30:12 | 显示全部楼层
刘哲 发表于 2014-8-8 09:01
还有一个问题就是,当纬度有小数的时候, 例如  -90 到 90 ,每隔0.5 去一个纬度,这样第一维坐标系数是 ...

文件中有关维的信息是固定好的,1度就是1度,没有办法每0.5度取值的,但是可以考虑取出后插值到0.5度。数组下标是没有范围限制的,这跟地理纬度的取值范围没有关系,不要搞混了。
密码修改失败请联系微信:mofangbao
回复 支持 1 反对 0

使用道具 举报

发表于 2014-8-7 20:33:13 | 显示全部楼层
TMP_P0_L1_GLL0是181*361的数组。第一维是纬度,范围从-90到90;第二维是经度,范围从0到359。
175是数组第一维下标,只要是从0到180的值都是合理的。

ListSetType(f, "cat")设置把4个文件中的TMP_P0_L1_GLL0变量读出后在第一维上进行合并,那么合并后第一维的大小就变成了181*4=724。
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-8-8 08:24:34 | 显示全部楼层
longlivehj 发表于 2014-8-7 20:33
TMP_P0_L1_GLL0是181*361的数组。第一维是纬度,范围从-90到90;第二维是经度,范围从0到359。
175是数组 ...

好的,谢谢!!!
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-8-8 08:26:46 | 显示全部楼层
longlivehj 发表于 2014-8-7 20:33
TMP_P0_L1_GLL0是181*361的数组。第一维是纬度,范围从-90到90;第二维是经度,范围从0到359。
175是数组 ...

还有一个问题就是,第一维是纬度,纬度是从小到大排的吗?
像是这样  (-90,0)
               (-89,1)
                (-88,2)
                ,,,,
                  ,,,,
                 (90,360)
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-8-8 09:01:58 | 显示全部楼层
longlivehj 发表于 2014-8-7 20:33
TMP_P0_L1_GLL0是181*361的数组。第一维是纬度,范围从-90到90;第二维是经度,范围从0到359。
175是数组 ...

还有一个问题就是,当纬度有小数的时候, 例如  -90 到 90 ,每隔0.5 去一个纬度,这样第一维坐标系数是不是就超过180了?这种情况该怎嘛处理?
密码修改失败请联系微信:mofangbao
发表于 2014-8-8 09:26:04 | 显示全部楼层
刘哲 发表于 2014-8-8 08:26
还有一个问题就是,第一维是纬度,纬度是从小到大排的吗?
像是这样  (-90,0)
               (-89, ...

文件中应该同时存在lat_0和lon_0两个变量,取出后打印出来,就知道经纬度的排列顺序了。
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-8-8 09:44:46 | 显示全部楼层
longlivehj 发表于 2014-8-8 09:26
文件中应该同时存在lat_0和lon_0两个变量,取出后打印出来,就知道经纬度的排列顺序了。

这个语法是 print(lat_0)?
密码修改失败请联系微信:mofangbao
发表于 2014-8-8 09:48:42 | 显示全部楼层
刘哲 发表于 2014-8-8 09:44
这个语法是 print(lat_0)?

哈哈,运行一下不就知道啦?
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-8-8 14:26:32 | 显示全部楼层
longlivehj 发表于 2014-8-8 09:48
哈哈,运行一下不就知道啦?

好的,谢谢!以后我给你当徒弟吧,我学成了,也去指导其他的人,把你这技术传播下去!
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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