[Thread Prev][Thread Next][Index]

RE: [ferret_users] conceptually-simple but oddly-complex sampling problem




Hi  Billy

May be "SAMPLEJ_MULTI"  is what you are looking for

I could not find its description in documentation page.  "sh func SAMPLEJ_MULTI" displays this..

SAMPLEJ_MULTI(J_INDICES,DAT_TO_SAMPLE)
    Returns data sampled according to J indices which may vary in IKL
    J_INDICES: ordered indices
    DAT_TO_SAMPLE: data to sample using J indices

Hope it works...

  
Regrads

Rahul S
Research fellow
Indian Institute of Tropical Meteorology
Pune, India

Rahul


> From: william.s.kessler@xxxxxxxx
> Subject: [ferret_users] conceptually-simple but oddly-complex sampling problem
> Date: Mon, 4 Aug 2014 15:59:30 -0700
> CC: william.s.kessler@xxxxxxxx
> To: ferret_users@xxxxxxxx
>
> Dear expert users :-)
>
> I have a grid A(y,t) that I want to sample according to a list B(y,t) of J-indices on the identical time axis as A.
> That is, I want to extract, at each timestep, the value of A at points B.
> Let's say A has shape (Ja,L), and B has shape (Jb,L)
>
> The output grid I expect would then have the shape (Jb,L); namely, at each timestep, sample the points in A according to the list in B.
>
> It sounds simple, but actually doing it seems harder.
>
> What I want is, conceptually: let OUT = samplej(A,B)
> But this fails because B is 2-d, and SAMPLEJ requires the list to be 1-d.
>
> I can do: let OUT = samplej(A,ysequence(B))
> This "works", but OUT now has the shape (Jb*L , L), because ysequence loses the time axis information and I end up with far more points than are justified: samplej has sampled each timestep by the list in B at _all_ timesteps.
>
> I could do it in a repeat loop:
> repeat/range=1:L/name=LL let OUT=samplej(A[l=LL],B[l=LL])
>
> Although each repeat step produces a grid of the correct length Jb, I see no way to put the result onto the desired (Jb,L) grid without writing it out and reading it back.
>
> Anyone have a better idea?
>
> Thanks ... Billy K
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> William S. Kessler
> NOAA / Pacific Marine Environmental Laboratory
> 7600 Sand Point Way NE
> Seattle WA 98115 USA
>
> william.s.kessler@xxxxxxxx
> Tel: 1-206-526-6221
> Fax: 1-206-526-6744
> Web: http://www.pmel.noaa.gov/people/kessler/
>
>

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement