<div dir="ltr"><div>Hello everyone,</div><div><br></div><div>I was trying to read netCDF 4 files with groups.</div><div>I have 6 groups.</div><div>They all have a variable named 'snd' inside.</div><div>The 6 'snd' are different (I used ncdump to check) but they look the same using NCL.</div>
<div><br></div><div>Here is my script:</div><div><br></div><div><div>; Complied by Wang Wenshan 2013-09-19 Thursday 12:06:55</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div>
<div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div>;*************************************************************</div><div>; check NCL group reading</div><div>;************************************************************</div>
<div>begin</div><div>;setfileoption("nc", "usenewhlfs", True)</div><div><br></div><div>drc = "/media/grele_data/wenshan/cesm/historical-exp/nco_grp/"</div><div>fn = "<a href="http://snd_time.nc">snd_time.nc</a>"</div>
<div><br></div><div>fin = addfile(drc+fn,"r")</div><div>setfileoption("nc", "Format", "NetCDF4Classic")</div><div><br></div><div>nn = getfilevarnames(fin)</div><div>;print(nn)</div>
<div>v1 = "/CCSM4_historical/snd"</div><div>v2 = "/CESM1-BGC_esmHistorical/snd"</div><div>v3 = "/CESM1-CAM5_historical/snd"</div><div>v4 = "/CESM1-FASTCHEM_historical/snd"</div><div>
v5 = "/CESM1-WACCM_historical/snd"</div><div><br></div><div>d1 = fin->$v1$</div><div>d2 = fin->$v2$</div><div>d3 = fin->$v3$</div><div>d4 = fin->$v4$</div><div>d5 = fin->$v5$</div><div><br></div>
<div>
;------------------------------------------------------------</div><div>; second way</div><div>;g5 = fin=>/CESM1-WACCM_historical</div><div>;d5_2 = g5->snd</div><div>;------------------------------------------------------------</div>
<div><br></div><div>print(d1+" "+d2+" "+d3+" "+d4+" "+d5)</div><div>;print(d1+" "+d2+" "+d3+" "+d4+" "+d5+" "+d5_2)</div><div>
<br></div><div>print("done!")</div><div>end</div></div><div><br></div><div><br></div><div>The first way gave me the same 'snd'.</div><div>The second way gave error msg: </div><div>file: Execute.c, line:8105</div>
<div>stop *ptr: 104</div><div>stop FILE_GROUPVAL_OP: 104</div><div><br></div><div>I am using NCL 6.1.2</div><div>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<br>
</div><div><br></div><div>I put my script (grp_reading.ncl) and the testing file (<a href="http://snd_time.nc">snd_time.nc</a>) on ftp/incoming.</div><div><br></div><div>Thank you very much!</div><div><br></div><br clear="all">
<div><div dir="ltr"><div><div><div><div>Best,<br></div>Wenshan<br>------------------------------------------------------------------------------<br></div>Graduate Student Researcher<br></div>Earth System Science<br></div>
University of California, Irvine<br></div></div>
</div>