<div dir="ltr"><div>I have no idea why you would want ascii file(s). ASCII is the least efficient method of storage.<br><br><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/sprintf.shtml" target="_blank">https://www.ncl.ucar.edu/<wbr>Document/Functions/Built-in/<wbr>sprintf.shtml</a><br><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/asciiwrite.shtml" target="_blank">https://www.ncl.ucar.edu/<wbr>Document/Functions/Built-in/<wbr>asciiwrite.shtml</a><br><br></div><div>You may have to alter the format for the variable. Please read the sprintf documentation.<br></div><div><br></div><div><br></div><div> nval = num(.not.ismissing(data)) <wbr> ; number of non-missinf values<br></div><div> data_str = new(nval,"string","No_<wbr>FillValue") ; array for strings<br></div><div><br></div><div>; crudest/simplest/least-<wbr>efficient method<br></div><div>; group by time<br></div><div><br></div><div> nv = -1<br></div><div> do nt=0,ntim-1<br></div><div> do nl=0,nlat-1<br></div><div> do ml=0,mlon-1<br></div><div> if (.not.ismissing(data(nt,nl,ml)<wbr>)) then<br></div><div> nv = nv+1<br></div><div> data_str(nv) = sprintf("%10.3f", data&time(nt)) \<br> <wbr> + sprintf("%7.3f" , data&lat(nl)) \<br> <wbr> + sprintf("%7.3f" , data&lon(ml)) \<br> <wbr> + sprintf("%7.3f" , data(nt,nl,ml) )<br></div><div> end if ; .not.(ismissing())<br></div><div> end do ; ml<br></div><div> end do ; nl<br></div><div> end do ; nt<br><br></div><div> diro = "./"<br></div><div> filo = "SST.txt"<br></div><div> ptho = diro+filo<br></div><div><b> asciiwrite( ptho, data_str)<br><br></b>----------------------------<br><br></div><div>You may want to alter the order. For each grid point, a time series.<br></div><div>Group by grid point<br></div><div><br></div><div> do nl=0,nlat-1<br></div><div> do ml-0,mlon-1<br></div><div> do nt=0,ntim-1<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 13, 2017 at 3:56 AM, Kunal Bali <span dir="ltr"><<a href="mailto:kunal.bali9@gmail.com" target="_blank">kunal.bali9@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 user<br><br></div><div>I have masked the ocean data. Now I am trying to extract the ocean data only. <br></div><div>So, how to extracted ASCII file of data_ocean_only variable in the given code below. <br><br></div><div>please provide some information that.<br><br></div><div>Thank You<br></div><div><br>begin<br>;---Read data <br> dir = "/home/kunal/mishra_sir/"<br> fnames = systemfunc("ls " + dir + "DAY_*.nc")<br> a = addfiles(fnames,"r")<br> mfile = addfile("/usr/local/lib/ncl/<wbr>lib/ncarg/data/cdf/<a href="http://landsea.nc" target="_blank">landsea.nc</a>"<wbr>,"r")<br> data = a[:]->sshf<br> data = data/100000<br> <br> lsmask = mfile->LSMASK<br> lsm = landsea_mask(lsmask,data&<wbr>latitude,data&longitude)<br> <br> data_ocean_only = mask(data,lsm.eq.0,True)<br> copy_VarMeta(data,data_ocean_<wbr>only) <br> <br> printVarSummary (data)<br> <br>en<font color="#1F497D">d</font><br><br>file detained is given as <br><br>Variable: data<br>Type: float<br>Total Size: 938060 bytes<br> 234515 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 31] x [latitude | 85] x [longitude | 89]<br>Coordinates: <br> time: [983223..983943]<br> latitude: [25.5..15]<br> longitude: [59..70]<br>Number Of Attributes: 4<br> standard_name : surface_upward_sensible_heat_<wbr>flux<br> long_name : Surface sensible heat flux<br> units : J m**-2<br> _FillValue : -32767<br><br><br></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>