<div dir="ltr">Hi Dennis,<div>Thanks for modifying the code. Now, it easily read the time, lat and lon coordinate. However, still it couldn't generate the dimension and variables correctly in the output file. It would be nice, if NCL could generate the the variables and dimension similar to the input file.</div><div><b><br></b></div><div><b>Output file:</b></div><div><br></div><div><div>ncdump -h tas_aave_Asia_bandpass30-100.nc</div><div>netcdf tas_aave_Asia_bandpass30-100 {</div><div>dimensions:</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>ncl0 = 1000 ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>ncl1 = 1 ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>ncl2 = 1 ;</div><div>variables:</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>double tasmask(ncl0, ncl1, ncl2) ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>tasmask:_FillValue = -999000000. ;</div><div>}</div><div><br></div><div><br></div><div><b>The variables and dimension in the input file is as given below.</b></div><div><br></div><div><div>dimensions:</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>lon = 1 ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>lat = 1 ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>time = UNLIMITED ; // (1000 currently)</div><div>variables:</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>double lon(lon) ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>lon:standard_name = "longitude" ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>lon:long_name = "longitude" ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>lon:units = "degrees_east" ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>lon:axis = "X" ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>double lat(lat) ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>lat:standard_name = "latitude" ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>lat:long_name = "latitude" ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>lat:units = "degrees_north" ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>lat:axis = "Y" ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>double time(time) ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>time:standard_name = "time" ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>time:long_name = "Time" ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>time:units = "years since 850-1-1 00:00:00" ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>time:calendar = "standard" ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>time:axis = "T" ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>double tasmask(time, lat, lon) ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>tasmask:_FillValue = -999000000. ;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>tasmask:missing_value = -999000000. ;</div></div><div><br></div><div><br></div><div>Thanks.</div><div>SB</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 7, 2017 at 2:20 PM, Dennis Shea <span dir="ltr"><<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span class="gmail-"> fn = "tas_aave_Asia.nc" ; define filename<div> in = addfile(fn,"r") ; open netcdf file</div></span><div> x = in->tasmask(:,0:0,0:0) ; get data; avoid elimination of degenerate dimension<br></div><div> printVarSummary(x) <wbr> ; x(time,lat,lon)<br></div><span class="gmail-"><div>; ******************************<wbr>*****************</div><div>; create the filter weights and apply</div><div>; ******************************<wbr>*****************</div><div><br></div><div> ihp = 2 ; band pass</div><div> sigma = 1.0 ; Lanczos sigma</div><div><br></div><div> nWgt = 201 ; loose 100 each end</div><div> fca = 1./100. ; start freq</div><div> fcb = 1./30. ; last freq</div><div> wgt = filwgts_lanczos (nWgt, ihp, fca, fcb, sigma )</div></span><div> xBPF = wgt_runave_n ( x, wgt, 0, 0 ) ; 30-100 days<br></div><div> printVarSummary(xBPF)<span class="gmail-"><br><br> ******************************<wbr>*****************<div>; create new date array for use on the plot</div><div>; ******************************<wbr>*****************</div><div> filo = "tas_aave_Asia_bandpass30-100.<wbr>nc"</div><div> system ("/bin/rm "+filo) ; remove any pre-existing file</div><div> fo = addfile(filo , "c") ; open output file</div><div><strong>;;</strong><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/filedimdef.shtml" target="_blank"><strong>filedimdef</strong></a>(fo,"time",-1,<wbr>True) ; make 'time' unlimited </div></span><div> fo->tasmax = xBPF ; write ud to a file</div></div></div><div class="gmail-HOEnZb"><div class="gmail-h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 7, 2017 at 6:04 AM, gibies george <span dir="ltr"><<a href="mailto:gibiesgeorge@gmail.com" target="_blank">gibiesgeorge@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">But where is your original coordinate?</div><div class="gmail-m_4992798245080541026HOEnZb"><div class="gmail-m_4992798245080541026h5"><div class="gmail_extra"><br><div class="gmail_quote">On Jul 7, 2017 4:01 PM, "S Br" <<a href="mailto:sbr.climate@gmail.com" target="_blank">sbr.climate@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div>Thanks for your reply. Now I reshaped the variable and put an arbitrary lat/lon value. Still, I couldn't open the file in GrADS.</div><div><br></div><div>I have checked the output file, it correctly reading the dimension but may be wrong with variables. </div><div><br></div><div><div>ncdump -h tas_aave_Asia_bandpass30-100.n<wbr>c</div><div>netcdf tas_aave_Asia_bandpass30-100 {</div><div>dimensions:</div><div><span class="gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>time = UNLIMITED ; // (1000 currently)</div><div><span class="gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>lat = 1 ;</div><div><span class="gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>lon = 1 ;</div><div>variables:</div><div><span class="gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>double tasmaskn(time, lat, lon) ;</div><div><span class="gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>tasmaskn:_FillValue = -999000000. ;</div><div><span class="gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>int lat(lat) ;</div><div><span class="gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>int lon(lon) ;</div><div>}</div></div><div><br></div><div>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><wbr>></div><div><br></div><div><div>; ******************************<wbr>*****************</div><div>; create new date array for use on the plot</div><div>; ******************************<wbr>*****************</div><div> filo = "tas_aave_Asia_bandpass30-100.<wbr>nc"</div><div> system ("/bin/rm "+filo) ; remove any pre-existing file</div><div> fo = addfile(filo , "c") ; open output file</div><div> filedimdef(fo,"time",-1,True) ; make 'time' unlimited</div><div> tasmask=xBPF</div><div> ntime = 1000</div><div> nlat = 1</div><div> nlon = 1</div><div> tasmaskn = reshape(tasmask,(/ntime,nlat,n<wbr>lon/))</div><div> printVarSummary(tasmaskn)</div><div> tasmaskn!0="time"</div><div> tasmaskn!1="lat"</div><div> tasmaskn&lat=nlat</div><div> tasmaskn!2="lon"</div><div> tasmaskn&lon=nlon</div><div> fo->tasmaskn = tasmaskn ; write ud to a file</div><div>end</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 7, 2017 at 8:45 AM, gibies george <span dir="ltr"><<a href="mailto:gibiesgeorge@gmail.com" target="_blank">gibiesgeorge@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">The first step I told is to reshape "tasmask" using reshape function. </div><div class="gmail_quote"><br></div><div class="gmail_quote">Secondly what I told is to put some arbitrary lat-lon coordinate value. </div><div><div class="gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891h5"><div class="gmail_quote"><br></div><div class="gmail_quote">On 6 July 2017 at 16:29, S Br <span dir="ltr"><<a href="mailto:sbr.climate@gmail.com" target="_blank">sbr.climate@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Gibies,<div>Thanks for your reply. I have added as you suggested. I get some error in the code. Do you think, I have done correctly.</div><div><br></div><div><span><div>; ******************************<wbr>*****************</div><div>; create new date array for use on the plot</div><div>; ******************************<wbr>*****************</div><div> filo = "tas_aave_Asia_bandpass30-100.<wbr>nc"</div><div> system ("/bin/rm "+filo) ; remove any pre-existing file</div><div> fo = addfile(filo , "c") ; open output file</div></span><span><div> filedimdef(fo,"time",-1,True) ; make 'time' unlimited</div></span><div> tasmask=xBPF</div><div> tasmask!0="time"</div><div> tasmask!1="lat"</div><div> tasmask&lat=<u><font color="#ff0000">"lat" </font></u></div><div> tasmask!2="lon"</div><div> tasmask&lon=<u><font color="#ff0000">"lon"</font></u></div><div> fo->tasmask = tasmask ; write ud to a file</div><div>end</div></div><div><br></div><div>I get the error as,</div><div><br></div><div><div>fatal:Variable (tasmask) has (1) dimensions can not write to dimension (1)</div><div>fatal:["Execute.c":8575]:Execu<wbr>te: Error occurred at or near line 38 in file bandpass.ncl</div></div><div><br></div><div>Thanks.</div><span class="gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891m_5030127381411256862HOEnZb"><font color="#888888"><div>SB</div><div><br></div><div><br></div><div><br></div></font></span></div><div class="gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891m_5030127381411256862HOEnZb"><div class="gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891m_5030127381411256862h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 6, 2017 at 10:13 AM, gibies george <span dir="ltr"><<a href="mailto:gibiesgeorge@gmail.com" target="_blank">gibiesgeorge@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div>I have seen those mails from Dr. Dennis and Dr. Adam.<div dir="auto"><br></div><div dir="auto">You can use reshape function to add additional coordinate to a variable. Define some single value coordinate for latitude and longitude.</div><div dir="auto"><br></div><div dir="auto">varname!0 ="time"</div><div dir="auto">varname!1 = "lat"</div><div dir="auto">varname&lat = .......</div><div dir="auto">varname!2 = "lon"</div><div dir="auto">varname&lon = ......</div><div><div class="gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891m_5030127381411256862m_3752893363194926388h5"><div dir="auto"><br></div><div dir="auto"><br></div><br><div class="gmail_extra"><br><div class="gmail_quote">On Jul 6, 2017 2:08 PM, "S Br" <<a href="mailto:sbr.climate@gmail.com" target="_blank">sbr.climate@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Gibies,<div>NCL also provided the same solution as you have mentioned.<br><div><div>Could you please tell me how can I add single value coordinates (time, lat, lon) to the variable.</div></div></div><div>Hope, you can write me the command for me.</div><div><br></div><div>Thanks.</div><div>SB</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 5, 2017 at 5:58 PM, gibies george <span dir="ltr"><<a href="mailto:gibiesgeorge@gmail.com" target="_blank">gibiesgeorge@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Yes, you can add single value coordinates (time lat lon) to the variable before saving it to nc file.</div><div class="gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891m_5030127381411256862m_3752893363194926388m_-3993977731678294765m_-2811224259625025701m_7970586787079507880HOEnZb"><div class="gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891m_5030127381411256862m_3752893363194926388m_-3993977731678294765m_-2811224259625025701m_7970586787079507880h5"><div class="gmail_extra"><br><div class="gmail_quote">On Jul 5, 2017 9:58 PM, "S Br" <<a href="mailto:sbr.climate@gmail.com" target="_blank">sbr.climate@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Is it possible to do something inside the NCL script so that it can be opened by GrADS.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 5, 2017 at 5:25 PM, gibies george <span dir="ltr"><<a href="mailto:gibiesgeorge@gmail.com" target="_blank">gibiesgeorge@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">This is because grads required standard file coordinates structure. Time lat lon etc.</div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891m_5030127381411256862m_3752893363194926388m_-3993977731678294765m_-2811224259625025701m_7970586787079507880m_-138813461870546186m_2678604644904053558h5">On Jul 5, 2017 9:43 PM, "S Br" <<a href="mailto:sbr.climate@gmail.com" target="_blank">sbr.climate@gmail.com</a>> wrote:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891m_5030127381411256862m_3752893363194926388m_-3993977731678294765m_-2811224259625025701m_7970586787079507880m_-138813461870546186m_2678604644904053558h5"><div dir="ltr">Hi,<div>I have applied bandpass filter to my one dimentional NetCDF file. I have written the output to a NetCDF file but this output file is not opening in GrADS. I get the following error.</div><div><br></div><div>ga-> sdfopen tas_aave_Asia_bandpass30-100.n<wbr>c</div><div><div>Scanning self-describing file: tas_aave_Asia_bandpass30-100.<wbr>nc</div><div>gadsdf: SDF file has no discernable X coordinate.</div><div> To open this file with GrADS, use a descriptor file with an XDEF entry.</div><div> Documentation is at <a href="http://cola.gmu.edu/grads/gadoc/SDFdescriptorfile.html" target="_blank">http://cola.gmu.edu/grads/gado<wbr>c/SDFdescriptorfile.html</a></div></div><div><br></div><div>Could you please suggest if I am doing somewhere wrong in my NCL script . The input file is perfectly fine with GrADS.<br></div><div><br></div><div><div>load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/gsn_csm.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/contributed.ncl"</div><div>begin</div><div><br></div><div> fn = "tas_aave_Asia.nc" ; define filename</div><div> in = addfile(fn,"r") ; open netcdf file</div><div> x = in->tasmask(:,0,0) ; get data</div><div><br></div><div>; ******************************<wbr>*****************</div><div>; create the filter weights and apply</div><div>; ******************************<wbr>*****************</div><div><br></div><div> ihp = 2 ; band pass</div><div> sigma = 1.0 ; Lanczos sigma</div><div><br></div><div> nWgt = 201 ; loose 100 each end</div><div> fca = 1./100. ; start freq</div><div> fcb = 1./30. ; last freq</div><div> wgt = filwgts_lanczos (nWgt, ihp, fca, fcb, sigma )</div><div> xBPF = wgt_runave ( x, wgt, 0 ) ; 30-100 days</div><div><br></div><div> copy_VarMeta(x,xBPF)</div><div> dNames= getvardims(xBPF)</div><div> dSIZES=dimsizes(xBPF)</div><div> print (dNames)</div><div> print (dSIZES)</div><div><br></div><div>; ******************************<wbr>*****************</div><div>; create new date array for use on the plot</div><div>; ******************************<wbr>*****************</div><div> filo = "tas_aave_Asia_bandpass30-100.<wbr>nc"</div><div> system ("/bin/rm "+filo) ; remove any pre-existing file</div><div> fo = addfile(filo , "c") ; open output file</div><div> tasmax=xBPF(:)</div><div> fo->tasmax = tasmax ; write ud to a file</div><div>end</div></div><div><br></div><div><br></div><div>Thanks.</div><div>SB</div><div><br></div><div><br></div></div>
<br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div></div>
</blockquote></div><br></div>
</blockquote></div></div>
</div></div></blockquote></div><br></div>
</blockquote></div></div>
</div></div></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>
</blockquote></div></div>
</div></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div>