<div dir="ltr">Hi Adams,<div>Many thanks. Finally, the script worked well and now I could open the output file in GrADS.</div><div>My final script is given below.</div><div><br></div><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>load "$NCARG_ROOT/lib/ncarg/nclscripts/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,0:0) ; get data; avoid elimination of degenerate dimension</div><div> printVarSummary(x) ; x(time,lat,lon)</div><div><br></div><div>; ***********************************************</div><div>; create the filter weights and apply</div><div>; ***********************************************</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_n_Wrap ( x, wgt, 0, 0 ) ; 30-100 days</div><div> printVarSummary(xBPF)</div><div><br></div><div>; ***********************************************</div><div>; create new date array for use on the plot</div><div>; ***********************************************</div><div> filo = "tas_aave_Asia_bandpass30-100.nc"</div><div> system ("/bin/rm "+filo) ; remove any pre-existing file</div><div> fo = addfile(filo , "c") ; open output file</div><div> fo->tasmask = xBPF ; write ud to a file</div><div>end</div></div><div><br></div><div>Regards</div><div>SB</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 4:41 PM, Adam Phillips <span dir="ltr"><<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</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>That line should be: </div><div><span style="font-size:12.8px"> fo->lat = in->lat(0:0)</span></div><div><span style="font-size:12.8px">(Note that the error message said that fn is not a valid file, alerting you to the fact that fn is not a reference to a file.)</span></div><div><br></div>Again, you shouldn't need to add that line. I just put that in there to show you that you can easily write a variable from one file to the next. </div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 7, 2017 at 8:59 AM, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Adam,<div>I tried to modify the code as below but I get some error for the line "fo->lat = fn->lat(0:0)"</div><div><br></div><div><div>Variable: x</div><div>Type: double</div><div>Total Size: 8000 bytes</div><div> 1000 values</div><div>Number of Dimensions: 1</div><div>Dimensions and sizes:<span class="m_-5603264313525385972m_7548284212300118749gmail-m_-3699026611653343423gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>[time | 1000]</div><div>Coordinates: </div><div> time: [ 0.. 999]</div><div>Number Of Attributes: 4</div><div> lon :<span class="m_-5603264313525385972m_7548284212300118749gmail-m_-3699026611653343423gmail-Apple-tab-span" style="white-space:pre-wrap">        </span> 0</div><div> lat :<span class="m_-5603264313525385972m_7548284212300118749gmail-m_-3699026611653343423gmail-Apple-tab-span" style="white-space:pre-wrap">        </span> 0</div><div> _FillValue :<span class="m_-5603264313525385972m_7548284212300118749gmail-m_-3699026611653343423gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>-999000000</div><div> missing_value :<span class="m_-5603264313525385972m_7548284212300118749gmail-m_-3699026611653343423gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>-999000000</div><div><br></div><div>Variable: xBPF</div><div>Type: double</div><div>Total Size: 8000 bytes</div><div> 1000 values</div><div>Number of Dimensions: 1</div><div>Dimensions and sizes:<span class="m_-5603264313525385972m_7548284212300118749gmail-m_-3699026611653343423gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>[time | 1000]</div><div>Coordinates: </div><div> time: [ 0.. 999]</div><div>Number Of Attributes: 5</div><div> _FillValue :<span class="m_-5603264313525385972m_7548284212300118749gmail-m_-3699026611653343423gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>-999000000</div><div> lon :<span class="m_-5603264313525385972m_7548284212300118749gmail-m_-3699026611653343423gmail-Apple-tab-span" style="white-space:pre-wrap">        </span> 0</div><div> lat :<span class="m_-5603264313525385972m_7548284212300118749gmail-m_-3699026611653343423gmail-Apple-tab-span" style="white-space:pre-wrap">        </span> 0</div><div> missing_value :<span class="m_-5603264313525385972m_7548284212300118749gmail-m_-3699026611653343423gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>-999000000</div><div> wgt_runave_op_ncl :<span class="m_-5603264313525385972m_7548284212300118749gmail-m_-3699026611653343423gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>wgt_runave_n</div><div>fatal:(fn) not reference to a valid file</div><div>fatal:["Execute.c":8575]:Execu<wbr>te: Error occurred at or near line 31 in file bandpass.ncl</div></div><div><br></div><div><b>The script is as below:</b></div><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> printVarSummary(x) ; x(time,lat,lon)</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_n_Wrap ( x, wgt, 0, 0 ) ; 30-100 days</div><div> printVarSummary(xBPF)</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> fo->lat = fn->lat(0:0)</div><div> fo->tasmask = xBPF ; write ud to a file</div><div>end</div></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 7, 2017 at 3:33 PM, Adam Phillips <span dir="ltr"><<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</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">One correction to Dennis' script:<div>use wgt_runave_n_Wrap instead of wgt_runave_n</div><div><br></div><div>After applying the above, you should not need to do this, but note that you can exactly copy variables from one file to another like so:</div><span><div><span style="font-size:12.8px">fn = "tas_aave_Asia.nc" ; define filename</span><div style="font-size:12.8px">in = addfile(fn,"r") </div></div></span><span><div style="font-size:12.8px"><span style="font-size:12.8px">x = in->tasmask(:,0:0,0:0)</span><br></div></span><div>.........</div><span><div><span style="font-size:12.8px">fo = addfile(filo , "c") ; open output file</span><br></div></span><div><span style="font-size:12.8px">fo->lat = fn->lat(0:0) ; (0:0) needed in your case as you are subsetting tasmask when reading it in</span></div><div><br></div></div><div class="gmail_extra"><div><div class="m_-5603264313525385972m_7548284212300118749h5"><br><div class="gmail_quote">On Fri, Jul 7, 2017 at 8:19 AM, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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.n<wbr>c</div><div>netcdf tas_aave_Asia_bandpass30-100 {</div><div>dimensions:</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>ncl0 = 1000 ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>ncl1 = 1 ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>ncl2 = 1 ;</div><div>variables:</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>double tasmask(ncl0, ncl1, ncl2) ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">                </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="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>lon = 1 ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>lat = 1 ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>time = UNLIMITED ; // (1000 currently)</div><div>variables:</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>double lon(lon) ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>lon:standard_name = "longitude" ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>lon:long_name = "longitude" ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>lon:units = "degrees_east" ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>lon:axis = "X" ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>double lat(lat) ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>lat:standard_name = "latitude" ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>lat:long_name = "latitude" ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>lat:units = "degrees_north" ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>lat:axis = "Y" ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>double time(time) ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>time:standard_name = "time" ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>time:long_name = "Time" ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>time:units = "years since 850-1-1 00:00:00" ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>time:calendar = "standard" ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>time:axis = "T" ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>double tasmask(time, lat, lon) ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>tasmask:_FillValue = -999000000. ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-Apple-tab-span" style="white-space:pre-wrap">                </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="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-"> 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="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-"><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="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-"><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,True<wbr>) ; make 'time' unlimited </div></span><div> fo->tasmax = xBPF ; write ud to a file</div></div></div><div class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-HOEnZb"><div class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-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="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-m_4992798245080541026HOEnZb"><div class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-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="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>time = UNLIMITED ; // (1000 currently)</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>lat = 1 ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>lon = 1 ;</div><div>variables:</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>double tasmaskn(time, lat, lon) ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>tasmaskn:_FillValue = -999000000. ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891gmail-Apple-tab-span" style="white-space:pre-wrap">        </span>int lat(lat) ;</div><div><span class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-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="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-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="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-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="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891m_5030127381411256862HOEnZb"><div class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-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="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-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="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-m_4992798245080541026m_-1347054313135642998m_-1003138672372989891m_5030127381411256862m_3752893363194926388m_-3993977731678294765m_-2811224259625025701m_7970586787079507880HOEnZb"><div class="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-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="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-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="m_-5603264313525385972m_7548284212300118749m_280866161305269451m_-7633576140342168719gmail-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>
<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><br clear="all"><span class="m_-5603264313525385972HOEnZb"><font color="#888888"><div><br></div></font></span></div></div><span class="m_-5603264313525385972HOEnZb"><font color="#888888"><span>-- <br><div class="m_-5603264313525385972m_7548284212300118749m_280866161305269451gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphill<wbr>i/</a> </font></span><span><font color="#888888"><a href="tel:(303)%20497-1726" value="+13034971726" target="_blank">303-497-1726</a> </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</span></font></span></div>
</blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_-5603264313525385972gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/<wbr>asphilli/</a> </font></span><span><font color="#888888"><a href="tel:(303)%20497-1726" value="+13034971726" target="_blank">303-497-1726</a> </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>
</div></div></blockquote></div><br></div>