[Thread Prev][Thread Next][Index]

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



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