[Thread Prev][Thread Next][Index]

[ferret_users] shuffle or how to permute randomly elements



Hi all,

I have coded a ferret script where 2 variables are
co-plotted with coloring samples with their latitudes.

It can be easilly achieved with the script polymark.
yes? go polymark
polygon/over/nolab/key/lev=(-90,90,10)/pal=centered/nolab/fill
w1,w2,w3,circle,0.5
No problem there. See 1st figure attached.

But as I worked from 2D variables, when I vectorize them,
I conserve their underlaying grid.

For now, I have done this using an external call to python/numpy

yes? go shuffle 10
yes? list shuffle
             VARIABLE : SHUFFLE
             FILENAME : shuffle.txt
             SUBSET   : 10 points (X)
 1    /  1:   3.00
 2    /  2:  10.00
 3    /  3:   8.00
 4    /  4:   4.00
 5    /  5:   7.00
 6    /  6:   6.00
 7    /  7:   5.00
 8    /  8:   1.00
 9    /  9:   2.00
 10   / 10:   9.00

Applying this shuffle to my samples with the
ferret samplei(v1, shuffle) gives me what I was
expecting (independant sample over their latitudes).
yes? go polymark
polygon/over/nolab/key/lev=(-90,90,10)/pal=centered/nolab/fill
samplei(w1,shuffle),samplei(w2,shuffle),samplei(w3,shuffle),circle,0.5
See fig2 attached.

I am wondering if a shuffle function could be added to ferret ?
Any news to share about link between python and ferret ?


Patrick

Attachment: ScatterPlot_02.gif
Description: GIF image

Attachment: ScatterPlot_03.gif
Description: GIF image

#!/bin/env python

import numpy, sys

a=numpy.random.permutation(int(sys.argv[1]))

for i in range(len(a)):
	print a[i]+1

Attachment: shuffle.jnl
Description: application/jnl


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

Privacy Policy | Disclaimer | Accessibility Statement