Re: Problem with saving data without long-lag into NetCDF file

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Dec 23 2009 - 11:34:50 MST

I assume you mean "long-lat".
To me the question is not clear.

SQ_VAR = new((/Nmodel, Ntime,Nseason/),float)

  SQ_VAR(:,0) = fin[:]->SQ_VAR_DJF
  SQ_VAR(:,1) = fin[:]->SQ_VAR_MAM
  SQ_VAR(:,2) = fin[:]->SQ_VAR_JJA
  SQ_VAR(:,3) = fin[:]->SQ_VAR_SON
  filedimdef(fout,"time",-1,True) ; only if "time" is
leftmost dimension
  fout@title = "enso var from model files"

  SQ_VAR!0 = "time"
  SQ_VAR!1 = "season"
  SQ_VAR@long_name = "..." ; optional
  SQ_VAR@units = "..." ; optional

  fout->SQ_VAR = SQ_VAR ; (time,season)

===========================
If you want (season, time)

  SQ_VAR = new((/Nseason,Ntime/),float)

  SQ_VAR(0,:) = fin[:]->SQ_VAR_DJF
  SQ_VAR(1,:) = fin[:]->SQ_VAR_MAM
  SQ_VAR(2,:) = fin[:]->SQ_VAR_JJA
  SQ_VAR(3,:) = fin[:]->SQ_VAR_SON
;;;; filedimdef(fout,"time",-1,True) ; not allowed
[netCDF rule] for non-record dimension
  fout@title = "enso var from model files"

  SQ_VAR!1 = "time"
  SQ_VAR!0 = "season"
  SQ_VAR@long_name = "..." ; optional
  SQ_VAR@units = "..." ; optional

  fout->SQ_VAR = SQ_VAR ; (time,season)

On 12/22/2009 10:28 PM, Arnold.Sullivan@csiro.au wrote:
> Dear NCL users,
> I had probelm with saving data without long-lag into NetCDF file, and
> hope someone could help me.
> **** code ************************************************
> diri = "/workst/all/var/" ; directory where files reside
> fili = systemfunc ("ls "+diri+"*_var.nc")
> fin = addfiles (fili, "r") ; note the "s" of addfile
> ListSetType (fin, "cat") ; concatenate or "merge"
> Nmodel = 24
> Nseason = 4
> SQ_VAR = new((/Nmodel,Nseason/),float)
> SQ_VAR(:,0) = fin[:]->SQ_VAR_DJF
> SQ_VAR(:,1) = fin[:]->SQ_VAR_MAM
> SQ_VAR(:,2) = fin[:]->SQ_VAR_JJA
> SQ_VAR(:,3) = fin[:]->SQ_VAR_SON
> filedimdef(fout,"time",-1,True)
> fout@title = "enso var from model files"
> ~~~~~
> fout->SQ_VAR = (/SQ_VAR/) ; write SQ_VAR to a file
> *** original data looks like *****************************
> Variable: SQ_VAR_SON (file variable)
> Type: float
> Total Size: 96 bytes
> 24 values
> Number of Dimensions: 1
> Dimensions and sizes: [time | 24]
> Coordinates:
> time [ 1.. 0]
> Number Of Attributes: 4
> missing_value : -1e+34
> _FillValue : -1e+34
> **** the output data looks like *****************************
> show from FERRET
> 1> ./merge_out.nc (default)
> name title I J
> K L
> SQ_VAR 1:24 1:4 ... ...
> Which is not what I want. I want data save as
> name title I J
> K L
> SQ_VAR ... ... 1:4 1:24
> How can I do it?
> Cheers,
> Arnold
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate&  Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Dec 23 11:36:05 2009

This archive was generated by hypermail 2.1.8 : Tue Dec 29 2009 - 10:29:16 MST