Re: two files with different timesteps

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon, 04 Feb 2008 19:52:25 -0700

[1] For convenience, I suggest the netCDF operator
      "ncrcat" to combine the 2nd set of files

               %> ncrcat b*nc B.nc

      Maybe you could use ncrcat or ncks with the "d" option
      to subset B.nc to match the times on file "a"

      Something like [please read documentation]

       ncks -d,time,0,7,8 B.nc newB.nc

[2] Further, assuming the times match, you could use ncdiff
      to difference the files.

[3] NCL

         xa = fa->X
         xb = fb->X(::4,:,:) ; or whatever

         if (.not.all(xa&time.eq.xb&time)) then
              print("times do not match")
              exit
         end if

            

Erik Noble wrote:
> Hi. I am actually having trouble with this. Could anyone offer a suggestion
> for my previous "loop" question below?
> -Erik
>
>
> On 2/1/08 5:14 PM, "Erik Noble" <enoble_at_giss.nasa.gov> wrote:
>
>
>> Hi.
>> Disregard my previous question. Due to an answer form an earlier post, I see
>> that I can can get around this by creating 2 separate new arrays before
>> entering the do loops and comparing them after.
>> Thanks.
>> -Erik
>>
>>
>> On 2/1/08 5:04 PM, "Erik Noble" <enoble_at_giss.nasa.gov> wrote:
>>
>>
>>> Hi.
>>>
>>> Are there any examples of reading in two different files that require
>>> their own loops for purposes of comparing a common variable between
>>> them?
>>> I am trying to read in one file "a" , which is a big file that has
>>> many timesteps (4 x daily). The other," b," is many files each with
>>> one timestep that corresponds with the time period of "a" (except 8 x
>>> daily).
>>>
> So I am trying to read in one file
> do it = 4, ntimes-1, 8
> And another set of files
> do ifil = 2, numFILES-1,4
>
>>> Could anyone offer a suggestion?
>>>
>>> Thank you in advance.
>>> Sincerely,
>>> Erik
>>>
>>> Here is the first loop:
>>>
>>> diri1 ="/Volumes/Data_and_Models/Model-Output/Athena/"
>>> ifile1 ="WRF-SOP3_Athena_3_1_2.nc"
>>> a=addfile(diri1+ifile1,"r")
>>> ; What times and how many time steps are in the data set?
>>> times = wrf_user_list_times(a) ; get times in the file
>>> ntimes = dimsizes(times) ; number of times in the file
>>>
>>> do it = 4, ntimes-1, 8 ; TIME LOOP of "a"
>>> ; GET VARIABLE
>>> v = wrf_user_getvar(a, "va",it) ; grid point variable
>>>
>>>
>>>
>>>
>>> Here is the second loop:
>>>
>>> DATADir = "/Volumes/Data_and_Models/NAMA-SOP3/" ; path to your
>>> data - must have trailing "/"
>>> FILES = systemfunc ("csh -c ' ls " + DATADir + "met_em.d01.2006* '")
>>> ; root of data file you want to plot
>>> numFILES = dimsizes(FILES)
>>> ;Create a loop out of how many files exist in the directory
>>> do ifil = 2, numFILES-1,4 ; Time loop of "b"
>>> b = addfile(FILES(ifil)+".nc","r")
>>> ; GET VARIABLE
>>> v700 = a->VV(0,10,1::,:)
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk_at_ucar.edu
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Feb 04 2008 - 19:52:25 MST

This archive was generated by hypermail 2.2.0 : Tue Feb 05 2008 - 17:17:22 MST