<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Dipti,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I&#39;m not sure that addfile can recognize Windows type of directory paths with &quot;C:\....&quot;.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Try using UNIX-style paths:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">ncdf=addfile(&quot;/Users/</span><span style="font-size:12.8px">Downloads/New\ folder/</span><a href="http://merra2_200.inst3_3d_asm_nv.19950830.nc/" target="_blank" style="font-size:12.8px">MERRA2_200.inst3_3d_<wbr>asm_Nv.19950830.nc</a><span style="font-size:12.8px">&quot;,&quot;c&quot;)</span><br style="font-size:12.8px"></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Note that I used forward slashes (&#39;/&#39;) instead of backward slashes (&#39;\&#39;).  However, since you have a space in one of your directory names----&quot;New folder&quot;---I put a backward slash in front of the space, just in case.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 28, 2017 at 5:55 PM, Dipti Sharma <span dir="ltr">&lt;<a href="mailto:sdipti596@gmail.com" target="_blank">sdipti596@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Dear NCL,<br><br></div><div>I am trying to write netCDF file for selected variable (wc, the vertical velocity here in this example) from MERRA-2 wind data. However, I always get an error message saying that<br> &quot; fatal:Could not create (C:\Users\Downloads\New folder\<a href="http://MERRA2_200.inst3_3d_asm_Nv.19950830.nc" target="_blank">MERRA2_200.inst3_3d_<wbr>asm_Nv.19950830.nc</a>)<br><br></div><div>Could someone please help me how to write the output file in netCDF. I want to have wc (time,lev) 2D data from 4D (time, lev,lat,lon). I just want the data at 1 location (1 lat and 1 lon).<br><br></div><div>Thank you very much in advance for your help.<br><br></div><div>Regards,<br><br></div><div>Dipti<br></div><div><br></div><div>Attached is the script that I used to read the data.<br></div><div><br></div><div><br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl&quot;<br>load &quot;$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl&quot;<br><br>; setfileoption(&quot;nc&quot;, &quot;FileStructure&quot;, &quot;Advanced&quot;)<br><br>fn = &quot;C:\Users\Downloads\New folder\MERRA2_200.inst3_3d_<wbr>asm_Nv.19950830.nc4&quot;<br>fn1 = &quot;C:\Users\Downloads\New folder\MERRA2_200.inst3_3d_<wbr>gas_Nv.19950830.nc4&quot;<br><br> fi = addfile(fn, &quot;r&quot;)<br>fi1= addfile(fn1, &quot;r&quot;)<br><br>; setfileoption(&quot;nc&quot;, &quot;Format&quot;,  &quot;NetCDF4Classic&quot;)<br><br> printVarSummary(fi)<br>;print(fi)<br><br> time = fi-&gt;time<br> lev = fi-&gt;lev<br> lat = fi-&gt;lat<br> lon = fi-&gt;lon<br> u = fi-&gt;U;(:,:,269,101)<br> v = fi-&gt;V;(:,:,269,101)<br> w=fi-&gt;OMEGA;(:,:,269,101)<br> p=fi-&gt;PL;(:,:,269,101)<br>den=fi1-&gt;AIRDENS;(:,:,269,101)<br>uh=u(:,:,269,101)<br>uv=v(:,:,269,101)<br>wv=w(:,:,269,101)<br>pv=PL(:,:,269,101)<br>denv=den(:,:,269,101)<br>;printVarSummary(u)<br>printVarSummary(denv)<br>printVarSummary(wv)<br>printMinMax(wv,True)  <br></div>;calculate vertical velocity<br><div>wc=(wv/(-9.8*denv))<br>printVarSummary(wc)<br>printMinMax(wc,True)<br>wc!0=&quot;time&quot;<br>wc!1=&quot;lev&quot;<br>;wc!2=&quot;lat&quot;<br>;wc!3=&quot;lon&quot;<br>datad = wc;(time|:,lev|:)<br>printVarSummary(datad)<br><br>;Writeout new netCDF file<br><br>wc&amp;time = time<br>wc&amp;lev = lev<br>ncdf=addfile(&quot;C:\Users\<wbr>Downloads\New folder\<a href="http://MERRA2_200.inst3_3d_asm_Nv.19950830.nc" target="_blank">MERRA2_200.inst3_3d_<wbr>asm_Nv.19950830.nc</a>&quot;,&quot;c&quot;)<br>ncdf-&gt;time= (/time/)<br>ncdf-&gt;lev=  (/lev/)<br>ncdf-&gt;data=(/datad/)<br>return<br></div><div>end<br></div><div><div class="gmail_extra"><br><br></div></div></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>