Re: random extraction of data

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu, 1 Mar 2007 17:07:58 -0700 (MST)

On Thu, 1 Mar 2007, Debasish Pai Mazumder wrote:

> Hi All,
> I have a temperature data which has dimension of latitude and longitude
> like,
>
> T(latitude=70, longitude=150)
>
> So I have 70X150=10500 girded temperature. I just want to extract the
> temperature for 500 grid points from total 10500 grids randomly.
>
> Is there any easy way to do that in NCL?

If you are talking about 500 grid points with replicates ... yes

  T(70,150)

  T1D = ndtooned(T)
  NR = 500
  IR = round( random_uniform(0,1, NR) , 3)
  TR = T1D(IR)
  
If you are talking about 500 unique grid points ... no easy way

Generate a very large number of IR
  
  IR = round( random_uniform(0,1, 10*NR) , 3)

Use a loop to get unique numbers [ IRU ] ... then use the 1st NR

   TR = T1D(IRU)

If you find an efficient way to do this ... let me know! :-)

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Mar 01 2007 - 17:07:58 MST

This archive was generated by hypermail 2.2.0 : Thu Mar 01 2007 - 18:02:36 MST