Re: Formatting the variables

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed, 27 Sep 2006 17:32:58 -0600 (MDT)

>Is there any way to create an out put Netcdf file in which different
>variables placed in different columns?
>using Format statement like Fortran .

This question is not clear.

say:

     a(N)
     b(N)
     c(N)
     
     3 variables [ nVar=3 ]
     
     x = new ( (/N, nVar/), typeof(a) )
     
     x(:,0) = (/ a /) ; (/ .../) do not copy meta data
     x(:,1) = (/ b /)
     x(:,2) = (/ c /)
     
     x_at_long_name = "a, b, c"
     x_at_units = "C, m/s, g/kg"
     x!0 = "observation"
     x!1 = "variable"
     
     Then write x to netCDF
     
     
 ---
 see: http://www.ncl.ucar.edu/Document/Functions/Built-in/sprintf.shtml
 
 You could put
 
   z = new ( N, "string")
 
   do n=0,N-1
    z(n) = sprinti("%6.0i", knt(n)) +" " \
          +sprintf("%9.5f", mylats(n)) +" " \
          +sprintf("%9.2f", mylons(n)) +" " \
          +sprintf("%9.3f", exacts(n)) +" " \
          +sprintf("%9.4f", mytemps(n))+" " \
          +sprintf("%9.4f", fo(n)) )
  end do
  
  
  Then write z to netCDF butt first you must convert to character.
  netCDF does not accept strings ... netCDF issue not NCL.
  
good luck

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Sep 27 2006 - 17:32:58 MDT

This archive was generated by hypermail 2.2.0 : Mon Oct 02 2006 - 16:30:14 MDT