登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
如何把grib2 文件中 数据 复制给新建的数组 数据描述: float PWAT_P0_L200_GLL0 ( lat_0, lon_0 ) center : US National Weather Service - NCEP (WMC) production_status : Operational products long_name : Precipitable water units : kg m-2 _FillValue : 1e+20 grid_type : Latitude/longitude parameter_discipline_and_category : Meteorological products, Moisture parameter_template_discipline_category_number : ( 0, 0, 1, 3 ) level_type : Entire atmosphere (considered as a single layer) 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" begin ;read the data diri = "/home/liuzhe/fnl_data/" fils = systemfunc("ls "+diri + "fnl_20110411*.grib2") f = addfiles(fils,"r") ListSetType(f ,"cat") r = f[:]->PWAT_P0_L200_GLL0 n1 = dimsizes(r&lat_0) n2 = dimsizes(r&lon_0) rt = new((/1,n1 ,n2/),"float") time1 = (/(/1/)/) rt!0 = "time" rt!1 = "lat" rt!2 = "lon" rt&time = time1 rt&lat = r&lat_0 rt&lon = r&lon_0 print(rt(0,40:100,40:100)) End 遇到的问题是,若直接对原来的r 进行操作 rain = dim_sum(r) ,这样就缺了了经度或者纬度,我就没法画图了,所以我想新建一个三维数组, rt(ntime , nlat ,nlon) ,然后我在用 dim_sum_n(rt) ,就可以保留经纬度 。但是遇到一个问题是print之后,rt与r 的对应值不一样,发现该方法不能把r 中经纬度所对应的值(降雨量)传递给 rt中,这也就是我在想如何把一个数组所有的值或者元数据都传递给另外一个数组。
|