<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're defining "time" but wrf has the dimension as "Time" 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'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 = "Time"</div><div class="gmail_default" style="font-family:verdana,sans-serif">T2_AV!1 = "south_north" </div><div class="gmail_default" style="font-family:verdana,sans-serif">T2_AV!2 = "west_east"</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"><<a href="mailto:asharma7@nd.edu" target="_blank">asharma7@nd.edu</a>></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 "$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)">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)">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)">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)">; ================================================;</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 = "/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)">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)">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)+".nc","r") ; 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->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("YEARd01_day001.nc","r")</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">LAT = f1->XLAT(0,:,:)</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)">LON = f1->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("/bin/rm -f WRF_T2_d01_2000_test.nc") ; remove any pre-existing file</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"> fout = addfile("WRF_T2_d01_2000_test.nc" ,"c") ; 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 = "NCL Simple Approach to netCDF Creation"</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"> fAtt@source_file = "<a href="http://original-file.nc" target="_blank">original-file.nc</a>"</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"> fAtt@Conventions = "None"</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"> fAtt@creation_date = systemfunc ("date")</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,"time",-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->XLAT</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"> XLONG = f1->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->XLAT = XLAT</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"> fout->XLONG = XLONG</div><div style="margin:0px;font-size:11px;font-family:Menlo;background-color:rgb(163,152,124)"> fout->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 = "XY " ;</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 = "LATITUDE, SOUTH IS NEGATIVE" ;</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 = "degree_north" ;</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 = "" ;</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 = "XY " ;</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 = "LONGITUDE, WEST IS NEGATIVE" ;</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 = "degree_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:stagger = "" ;</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 = "Mon Nov 2 12:12:21 MST 2015" ;</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 = "None" ;</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 = "<a href="http://original-file.nc" target="_blank">original-file.nc</a>" ;</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>