<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'm not sure that addfile can recognize Windows type of directory paths with "C:\....".</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("/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">","c")</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 ('/') instead of backward slashes ('\'). However, since you have a space in one of your directory names----"New folder"---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"><<a href="mailto:sdipti596@gmail.com" target="_blank">sdipti596@gmail.com</a>></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> " 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 "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/<wbr>nclscripts/csm/gsn_csm.ncl"<br><br>; setfileoption("nc", "FileStructure", "Advanced")<br><br>fn = "C:\Users\Downloads\New folder\MERRA2_200.inst3_3d_<wbr>asm_Nv.19950830.nc4"<br>fn1 = "C:\Users\Downloads\New folder\MERRA2_200.inst3_3d_<wbr>gas_Nv.19950830.nc4"<br><br> fi = addfile(fn, "r")<br>fi1= addfile(fn1, "r")<br><br>; setfileoption("nc", "Format", "NetCDF4Classic")<br><br> printVarSummary(fi)<br>;print(fi)<br><br> time = fi->time<br> lev = fi->lev<br> lat = fi->lat<br> lon = fi->lon<br> u = fi->U;(:,:,269,101)<br> v = fi->V;(:,:,269,101)<br> w=fi->OMEGA;(:,:,269,101)<br> p=fi->PL;(:,:,269,101)<br>den=fi1->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="time"<br>wc!1="lev"<br>;wc!2="lat"<br>;wc!3="lon"<br>datad = wc;(time|:,lev|:)<br>printVarSummary(datad)<br><br>;Writeout new netCDF file<br><br>wc&time = time<br>wc&lev = lev<br>ncdf=addfile("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>","c")<br>ncdf->time= (/time/)<br>ncdf->lev= (/lev/)<br>ncdf->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>