Re: NCL Array Assembly for write_matrix

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue Sep 27 2011 - 11:49:39 MDT

I would suggest asciiwrite. Try the following. You can alter 'time_txt'
to include just the times you want.

Good luck

load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

   f = addfile("...","r")
   time_chr = f->Times
  ;print(time_chr)

   time_str = wrf_user_list_times(f)
  ;print(time_str)

   TIME_0 = WRF_Times2Udunits_c(time_chr, 0) ; opt=0
  ;print(TIME_0)

   TIME_1 = WRF_Times2Udunits_c(time_chr, 1) ; opt=1
  ;print(TIME_1)

   time_txt = time_str+" "+sprintf("%5.0f", TIME_0) +"
"+sprintf("%10.0f", TIME_1)
   print(time_txt)

   dout = "./" ; output dir
   fout = "quelet.txt" ; output file name
   pout = dout+fout
   system("/bin/rm -f "+pout) ; remove any pre-existing file
   asciiwrite(pout , time_txt)

On 9/27/11 9:43 AM, Quelet, Paul T (E R WP AM TI) wrote:
> Dear NCL Help,
> I am trying to assemble two one-dimensional arrays, each of which is
> exactly 73 values, from a WRF forecast. The first variable comes from
> wrf_user_list_times() and the other is from WRF_Times2Udunits_c(). That
> means the first array is a double and the second is a string. I am able
> to extract the year, month, day, etc. from the date string using
> str_get_cols() and then convert them to integers using stringtoint.
> What I want to do is write out both strings side-by-side to an ascii
> type file using the write_matrix() command and give a header. I am fine
> with modifying the format of the date string. I have tried
> array_append_record() as well as table_attach_columns() to no avail.
> Can someone help me? This seemed straightforward, but was not sure if
> there is an NCL way to assemble two 1D arrays together side by side into
> a new array to be able to print out using write_matrix. Thanks in
> advance for any help!!
> --Paul Quelet
> *________________________________*
> *_SIEMENS_
> **Paul T. Quelet*
> Meteorologist
> Siemens Energy, Wind R&D
> 1050 Walnut Street, Suite 303
> Boulder, CO 80302
> _Phone_: 303-895-2059
> _Fax_: 303-895-2101
> paul.quelet@siemens.com
> *________________________________*
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Sep 27 11:49:46 2011

This archive was generated by hypermail 2.1.8 : Tue Sep 27 2011 - 15:14:38 MDT