On 2nd thought, after seeing 'time = 31' .... are these daily means?
If so, maybe interleaving is what you want. If so, much the same code...
ntimd = desdsize(0)
ntima = ascdsize(0)
NTIM = ntimd+ntima
AIRST = new((/NTIM,desdsize(1),desdsize(2),desdsize(3)/),float)
; (/ ... /) no meta data, just array values
AIRST(::2,:,:,:) = (/ AIRSTdes /) ; descending
AIRST(1::2,:,:,:) = (/ AIRSTasc /) ; ascending
printVarSummary(AIRST)
copy_VarMeta(AIRSTdes(0,:,:,:), AIRST(0,:,:,:) ) ; copy spatial meta
printVarSummary(AIRST)
; create 'time' coordinate variable
time = new(NTIM, float, "No_FillValue")
time(::2) = (/ AIRSTdes&time /) ; or (/ a->time /)
time(1::2:) = (/ AIRSTasc&time /) ; or (/ b->time /)
time!0 = "time"
time@units = AIRSTdes&time@units ; same units des and asc
AIRST!0 = "time"
AIRST&time = time
printVarSummary(AIRST)
print(AIRST&time) ; look at each time value
On 10/2/13 7:10 AM, Dennis Shea wrote:
> Don't think this is correct
> AIRST(::2,:,:,:) = AIRSTdes
> AIRST(1::2,:,:,:) = AIRSTasc
> The above is interleaving the times.
>
> ====
>
> Maybe:
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> ntimd = desdsize(0)
> ntima = ascdsize(0)
> NTIM = ntimd+ntima
> AIRST = new((/NTIM,desdsize(1),desdsize(2),desdsize(3)/),float)
> ; (/ ... /) no meta data
> AIRST(:ntimd-1,:,:,:) = (/ AIRSTdes /) ; descending
> AIRST(ntimd:,:,:,:) = (/ AIRSTasc /) ; ascending
> printVarSummary(AIRST)
>
> copy_VarMeta(AIRSTdes(0,:,:,:), AIRST(0,:,:,:) ) ; copy spatial meta
> printVarSummary(AIRST)
>
> time = new(NTIM, float, "No_FillValue")
> time(:ntimd-1) = (/ AIRSTdes&time /) ; or (/ a->time /)
> time(ntimd: ) = (/ AIRSTasc&time /) ; or (/ b->time /)
> time!0 = "time"
> time@units = AIRSTdes&time@units ; same units des and asc
> AIRST!0 = "time"
> AIRST&time = time
>
> printVarSummary(AIRST)
> print(AIRST&time) ; look at each time value
>
>
> ====================================
>
> S
>
> On 10/1/13 11:29 PM, Ditiro Moalafhi wrote:
>> Dear NCL users,
>>
>> I am joining two files (one for ascending and the other for descending AIRS data) but am struggling to get the file time attributes into the new file. The descending file contains daily temperature data at 1:30am while ascending contains daily Temperatre at 13:00hrs. The times are in UTC. Could someone help. Below is my script that I am using
>>
>> ;load files and read dimensions
>> system("/bin/rm -f AIRST_2012f.nc")
>>
>> a = addfile("AIRST_2012fdes.nc","w")
>> print(a)
>> AIRSTdes = a->AIRSTdes
>> b = addfile("AIRST_2012fasc.nc","w")
>> print(b)
>> AIRSTasc = b->AIRSTasc
>>
>> ;define dimensions
>> desdsize = dimsizes(AIRSTdes)
>> desdsize = (/desdsize(0),desdsize(1),desdsize(2),desdsize(3)/)
>> ascdsize = dimsizes(AIRSTasc)
>> ascdsize = (/ascdsize(0),ascdsize(1),ascdsize(2),ascdsize(3)/)
>>
>>
>> ;define total variable
>>
>> ;create new variable
>> AIRST = new((/desdsize(0)+ascdsize(0),desdsize(1),desdsize(2),desdsize(3)/),float)
>> AIRST(::2,:,:,:) = AIRSTdes
>> AIRST(1::2,:,:,:) = AIRSTasc
>> AIRST!0 = "time"
>> AIRST&time = time
>>
>> ;write output file
>> system("/bin/rm -f AIRST_2012f.nc")
>> fout=addfile("AIRST_2012f.nc","c")
>> fout@title="AIRST_2012f"
>> fout->AIRST = AIRST
>> printVarSummary(AIRST)
>>
>>
>> One of the files (AIRST_2012fasc) attributes which are common to both are:
>> title : AIRST_2012fasc
>> dimensions:
>> time = 31
>> level = 11
>> LAT = 3
>> LON = 47
>> variables:
>> float AIRSTasc ( time, level, LAT, LON )
>> _FillValue : -9999
>> hdf_name : Temperature_A
>>
>> float time ( time )
>> _FillValue : 9.96921e+36
>> units : Days since 0UTC 1 January 2000
>>
>> float level ( level )
>> units : hPa
>>
>> float LAT ( LAT )
>> units : degrees_south
>>
>> float LON ( LON )
>> units : degrees_east
>>
>> Thank you
>> Ditiro
>>
>>
>>
>>
>> _______________________________________________
>> 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
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Oct 2 07:28:13 2013
This archive was generated by hypermail 2.1.8 : Fri Oct 04 2013 - 16:45:17 MDT