<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hello,<div class=""><br class=""></div><div class="">I created a netcdf output file. But I am not able to get proper dimensions. I think I need proper dimensions to perform nco operations on the .nc file. I saw an NCL page on creating the output file, but it assumes the output variables already have dimensions and no meta data.&nbsp;<a href="https://www.ncl.ucar.edu/Applications/o-netcdf.shtml" class="">https://www.ncl.ucar.edu/Applications/o-netcdf.shtml</a></div><div class=""><br class=""></div><div class=""><b class="">Here I need to create dimensions and meta data.</b></div><div class="">Could you please help me to get proper dimensions with the output variable, so that I can use NCO tool. I have attached ncl code, ncdump file and NCO script for suggestion.&nbsp;</div><div class=""><br class=""></div><div class="">Here is my code:</div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">;================================================;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">; ================================================;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">begin</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">;=================================================;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124); min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">datadir_00 = "/glade/scratch/sharmaa/BLUE_WATERS_PROJECT/nco_wrf2000/"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">FILES_00 = systemfunc ("ls -1 " + datadir_00 + "2000d01_day00* " )</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">numFILES_00 = dimsizes(FILES_00)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">print(FILES_00)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124); min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">sn = 515</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">we = 599</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124); min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">dailyT2maxS_00&nbsp; = new((/numFILES_00,sn,we/),float)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">dailyT2minS_00&nbsp; = new((/numFILES_00,sn,we/),float)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">dailyT2avS_00 &nbsp; = new((/numFILES_00,sn,we/),float)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124); min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">do ifil = 0,numFILES_00-1</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; a_00 = addfile(FILES_00(ifil)+".nc","r") &nbsp; ; Open the next file</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; temp_00 = a_00-&gt;T2 ; perturbation potential temperature (theta)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; temp_00 = temp_00 - 273.15</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124); min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; dailyT2maxS_00(ifil,:,:) = dim_max_n_Wrap(temp_00,0)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; dailyT2minS_00(ifil,:,:) = dim_min_n_Wrap(temp_00,0)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; dailyT2avS_00(ifil,:,:)&nbsp; = (dailyT2maxS_00(ifil,:,:)+dailyT2minS_00(ifil,:,:))/2</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124); min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">end do</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124); min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">;=================================================;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">f1 = addfile("YEARd01_day001.nc","r")</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">LAT = f1-&gt;XLAT(0,:,:)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">LON = f1-&gt;XLONG(0,:,:)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">;=================================================;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">;=================================================;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">;OPEN NEW NETCDF FOR WRITING</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">;-------------------------------------------------</div></div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124); min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; &nbsp; &nbsp; system("/bin/rm -f WRF_T2_d01_2000_test.nc") &nbsp; ; remove any pre-existing file</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; &nbsp; &nbsp; fout = addfile("WRF_T2_d01_2000_test.nc" ,"c")&nbsp; ; open output netCDF file</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">;===================================================================</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp; &nbsp; ; create global attributes of the file (optional)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp; &nbsp; ;===================================================================</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; &nbsp; &nbsp; fAtt &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = True&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; assign file attributes</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; &nbsp; &nbsp; fAtt@title &nbsp; &nbsp; &nbsp; &nbsp; = "NCL Simple Approach to netCDF Creation"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; &nbsp; &nbsp; fAtt@source_file &nbsp; =&nbsp; "original-file.nc"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; &nbsp; &nbsp; fAtt@Conventions &nbsp; = "None"</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; &nbsp; &nbsp; fAtt@creation_date = systemfunc ("date")</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; &nbsp; &nbsp; fileattdef( fout, fAtt )&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ; copy file attributes</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124); min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp; &nbsp; ;===================================================================</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp; &nbsp; ; make time an UNLIMITED dimension; recommended&nbsp; for most applications</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp; &nbsp; ;===================================================================</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; &nbsp; &nbsp; filedimdef(fout,"time",-1,True)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124); min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp; &nbsp; ;===================================================================</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp; &nbsp; ; output variables directly; NCL will call appropriate functions</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp; &nbsp; ; to write the meta data associated with each variable</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp; &nbsp; ;===================================================================</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124); min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;XLAT = f1-&gt;XLAT</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;XLONG = f1-&gt;XLONG</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124); min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; &nbsp; &nbsp; fout-&gt;XLAT&nbsp; = XLAT</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; &nbsp; &nbsp; fout-&gt;XLONG&nbsp; = XLONG</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">&nbsp;&nbsp; &nbsp; &nbsp; fout-&gt;T2_AV = dailyT2avS_00</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124); min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">end</div></div><div class=""><br class=""></div><div class="">Here is the ncdump file:</div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">[sharmaa@yslogin1 T2_SIM]$ ncdump -h WRF_T2_d01_2000_test.nc&nbsp;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">netcdf WRF_T2_d01_2000_test {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">dimensions:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>time = UNLIMITED ; // (0 currently)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>Time = 24 ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>south_north = 515 ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>west_east = 599 ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>ncl4 = 9 ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>ncl5 = 515 ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>ncl6 = 599 ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">variables:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>float XLAT(Time, south_north, west_east) ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>XLAT:FieldType = 104 ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>XLAT:MemoryOrder = "XY " ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>XLAT:description = "LATITUDE, SOUTH IS NEGATIVE" ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>XLAT:units = "degree_north" ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>XLAT:stagger = "" ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>float XLONG(Time, south_north, west_east) ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>XLONG:FieldType = 104 ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>XLONG:MemoryOrder = "XY " ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>XLONG:description = "LONGITUDE, WEST IS NEGATIVE" ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>XLONG:units = "degree_east" ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>XLONG:stagger = "" ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">        </span><b class="">float T2_AV(ncl4, ncl5, ncl6) ;</b></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><b class=""><span class="Apple-tab-span" style="white-space:pre">                </span>T2_AV:_FillValue = 9.96921e+36f ;</b></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124); min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">// global attributes:</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>:creation_date = "Mon Nov&nbsp; 2 12:12:21 MST 2015" ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>:Conventions = "None" ;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>:source_file = "original-file.nc" ;</div></div><div class=""><br class=""></div><div class="">Here is the issue with NCO operation:</div><div class=""><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">[sharmaa@yslogin1 T2_SIM]$ ncrcat -d ncl4,1,5 -v T2_AV&nbsp;WRF_T2_d01_2000_test.nc&nbsp;test.nc</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">ncrcat: ERROR no variables fit criteria for processing</div><div style="margin: 0px; font-size: 11px; font-family: Menlo; background-color: rgb(163, 152, 124);" class="">ncrcat: HINT Extraction list must contain a record variable which to concatenate</div></div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>