reading groups

From: Wenshan Wang <wenshanw_at_nyahnyahspammersnyahnyah>
Date: Thu Sep 19 2013 - 13:46:52 MDT

Hello everyone,

I was trying to read netCDF 4 files with groups.
I have 6 groups.
They all have a variable named 'snd' inside.
The 6 'snd' are different (I used ncdump to check) but they look the same
using NCL.

Here is my script:

; Complied by Wang Wenshan 2013-09-19 Thursday 12:06:55
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;*************************************************************
; check NCL group reading
;************************************************************
begin
;setfileoption("nc", "usenewhlfs", True)

drc = "/media/grele_data/wenshan/cesm/historical-exp/nco_grp/"
fn = "snd_time.nc"

fin = addfile(drc+fn,"r")
setfileoption("nc", "Format", "NetCDF4Classic")

nn = getfilevarnames(fin)
;print(nn)
v1 = "/CCSM4_historical/snd"
v2 = "/CESM1-BGC_esmHistorical/snd"
v3 = "/CESM1-CAM5_historical/snd"
v4 = "/CESM1-FASTCHEM_historical/snd"
v5 = "/CESM1-WACCM_historical/snd"

d1 = fin->$v1$
d2 = fin->$v2$
d3 = fin->$v3$
d4 = fin->$v4$
d5 = fin->$v5$

;------------------------------------------------------------
; second way
;g5 = fin=>/CESM1-WACCM_historical
;d5_2 = g5->snd
;------------------------------------------------------------

print(d1+" "+d2+" "+d3+" "+d4+" "+d5)
;print(d1+" "+d2+" "+d3+" "+d4+" "+d5+" "+d5_2)

print("done!")
end

The first way gave me the same 'snd'.
The second way gave error msg:
file: Execute.c, line:8105
stop *ptr: 104
stop FILE_GROUPVAL_OP: 104

I am using NCL 6.1.2
Linux grele 3.5.0-40-generic #62~precise1-Ubuntu SMP Fri Aug 23 17:38:26
UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

I put my script (grp_reading.ncl) and the testing file (snd_time.nc) on
ftp/incoming.

Thank you very much!

Best,
Wenshan
------------------------------------------------------------------------------
Graduate Student Researcher
Earth System Science
University of California, Irvine

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Sep 19 13:47:23 2013

This archive was generated by hypermail 2.1.8 : Tue Oct 01 2013 - 14:41:43 MDT