<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Not going to be an exhaustive reply but some starting points. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">NCL is case sensitive for variables.  You&#39;re defining &quot;time&quot; but wrf has the dimension as &quot;Time&quot; these are not the same. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"> T2_AV has no metadata so ncl doesn&#39;t know what to associate it with.  </div><div class="gmail_default" style="font-family:verdana,sans-serif">Either define T2_AV in the filevardef section, with correct coordinates, as will be done in the example io scripts, or define the coordinates in the script. e.g.</div><div class="gmail_default" style="font-family:verdana,sans-serif">T2_AV!0 = &quot;Time&quot;</div><div class="gmail_default" style="font-family:verdana,sans-serif">T2_AV!1 = &quot;south_north&quot; </div><div class="gmail_default" style="font-family:verdana,sans-serif">T2_AV!2 = &quot;west_east&quot;</div><div class="gmail_default" style="font-family:verdana,sans-serif">These three lines would get you quite far.  </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">When done correctly you should only have 3 dimensions in your netcdf.  time,lat,lon named whatever you want; just be consistent. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Guess the next rhetorical question is why not just do the NCO operation in the ncl script and only output the desired data. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Good luck, </div><div class="gmail_default" style="font-family:verdana,sans-serif">Alan. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 2, 2015 at 2:22 PM, Ashish Sharma <span dir="ltr">&lt;<a href="mailto:asharma7@nd.edu" target="_blank">asharma7@nd.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hello,<div><br></div><div>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. <a href="https://www.ncl.ucar.edu/Applications/o-netcdf.shtml" target="_blank">https://www.ncl.ucar.edu/Applications/o-netcdf.shtml</a></div><div><br></div><div><b>Here I need to create dimensions and meta data.</b></div><div>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. </div><div><br></div><div>Here is my code:</div><div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">;================================================;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl&quot;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">; ================================================;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">begin</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">;=================================================;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124);min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">datadir_00 = &quot;/glade/scratch/sharmaa/BLUE_WATERS_PROJECT/nco_wrf2000/&quot;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">FILES_00 = systemfunc (&quot;ls -1 &quot; + datadir_00 + &quot;2000d01_day00* &quot; )</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">numFILES_00 = dimsizes(FILES_00)</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">print(FILES_00)</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124);min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">sn = 515</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">we = 599</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124);min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">dailyT2maxS_00  = new((/numFILES_00,sn,we/),float)</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">dailyT2minS_00  = new((/numFILES_00,sn,we/),float)</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">dailyT2avS_00   = 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"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">do ifil = 0,numFILES_00-1</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">   a_00 = addfile(FILES_00(ifil)+&quot;.nc&quot;,&quot;r&quot;)   ; Open the next file</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">   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)">   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"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">   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)">   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)">   dailyT2avS_00(ifil,:,:)  = (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"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">end do</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124);min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">;=================================================;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">f1 = addfile(&quot;YEARd01_day001.nc&quot;,&quot;r&quot;)</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">LAT = f1-&gt;XLAT(0,:,:)</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">LON = f1-&gt;XLONG(0,:,:)</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">;=================================================;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">;=================================================;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">;OPEN NEW NETCDF FOR WRITING</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">;-------------------------------------------------</div></div><div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124);min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">       system(&quot;/bin/rm -f WRF_T2_d01_2000_test.nc&quot;)   ; remove any pre-existing file</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">       fout = addfile(&quot;WRF_T2_d01_2000_test.nc&quot; ,&quot;c&quot;)  ; open output netCDF file</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">;===================================================================</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">    ; create global attributes of the file (optional)</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">    ;===================================================================</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">       fAtt               = True            ; assign file attributes</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">       fAtt@title         = &quot;NCL Simple Approach to netCDF Creation&quot;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">       fAtt@source_file   =  &quot;<a href="http://original-file.nc" target="_blank">original-file.nc</a>&quot;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">       fAtt@Conventions   = &quot;None&quot;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">       fAtt@creation_date = systemfunc (&quot;date&quot;)</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">       fileattdef( fout, fAtt )            ; copy file attributes</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124);min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">    ;===================================================================</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">    ; make time an UNLIMITED dimension; recommended  for most applications</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">    ;===================================================================</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">       filedimdef(fout,&quot;time&quot;,-1,True)</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124);min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">    ;===================================================================</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">    ; 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)">    ; 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)">    ;===================================================================</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124);min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"> XLAT = f1-&gt;XLAT</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"> XLONG = f1-&gt;XLONG</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124);min-height:13px"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">       fout-&gt;XLAT  = XLAT</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">       fout-&gt;XLONG  = XLONG</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">       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"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">end</div></div><div><br></div><div>Here is the ncdump file:</div><div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">[sharmaa@yslogin1 T2_SIM]$ ncdump -h WRF_T2_d01_2000_test.nc </div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">netcdf WRF_T2_d01_2000_test {</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">dimensions:</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">        </span>time = UNLIMITED ; // (0 currently)</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">        </span>Time = 24 ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">        </span>south_north = 515 ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">        </span>west_east = 599 ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">        </span>ncl4 = 9 ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">        </span>ncl5 = 515 ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">        </span>ncl6 = 599 ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">variables:</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">        </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)"><span style="white-space:pre-wrap">                </span>XLAT:FieldType = 104 ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">                </span>XLAT:MemoryOrder = &quot;XY &quot; ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">                </span>XLAT:description = &quot;LATITUDE, SOUTH IS NEGATIVE&quot; ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">                </span>XLAT:units = &quot;degree_north&quot; ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">                </span>XLAT:stagger = &quot;&quot; ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">        </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)"><span style="white-space:pre-wrap">                </span>XLONG:FieldType = 104 ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">                </span>XLONG:MemoryOrder = &quot;XY &quot; ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">                </span>XLONG:description = &quot;LONGITUDE, WEST IS NEGATIVE&quot; ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">                </span>XLONG:units = &quot;degree_east&quot; ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">                </span>XLONG:stagger = &quot;&quot; ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">        </span><b>float T2_AV(ncl4, ncl5, ncl6) ;</b></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><b><span style="white-space:pre-wrap">                </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"><br></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">// global attributes:</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">                </span>:creation_date = &quot;Mon Nov  2 12:12:21 MST 2015&quot; ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">                </span>:Conventions = &quot;None&quot; ;</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"><span style="white-space:pre-wrap">                </span>:source_file = &quot;<a href="http://original-file.nc" target="_blank">original-file.nc</a>&quot; ;</div></div><div><br></div><div>Here is the issue with NCO operation:</div><div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">[sharmaa@yslogin1 T2_SIM]$ ncrcat -d ncl4,1,5 -v T2_AV WRF_T2_d01_2000_test.nc <a href="http://test.nc" target="_blank">test.nc</a></div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">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)">ncrcat: HINT Extraction list must contain a record variable which to concatenate</div></div><div><br></div><div><br></div></div><br>_______________________________________________<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/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>