Home »
Public Forums »
archive »
where function
where function [message #74524] |
Sun, 23 January 2011 12:26 |
smuzz
Messages: 7 Registered: January 2011
|
Junior Member |
|
|
Hi --
I am a beginner programmer trying to write a code involving the where
function. My dataset includes call detections made by whales from 1
month. I am trying to search within this dataset for a particular call
type, let's call it a moan. Then I want to search 1 hour before or
after a detected moan and tally up all the other whale calls I hear --
this is the part I am stuck on. How do you use the where function to
search 1 hour before or after? I am only familiar with using gt and
lt.
This is what I have so far...
n=n_elements(auto) ; auto is my dataset with all whale calls
for i=0, n-1 do begin
k = where(auto(*).manual_species eq 0 and auto(*).manual_call_type eq
1 and auto(*).time gt stime and auto(*).time lt etime,kcount) ; this
is looking for all moans within a specified start and end time of the
1 month study
if(kcount gt 0) then begin
j=where(auto(*).mdist lt 3.0 and auto(*).avg_amplitude ge 12.0 and
auto(*).time gt stime and auto(*).time lt etime and
auto(*).manual_species eq 7 and auto(*).manual_call_type eq
1,jcount) ; this is looking for all other whale calls within the
dataset
....right now j is tallying up all the calls in the dataset, but now I
want to add in a part asking for only calls that occur 1 hour before
or after a moan detection?
Any ideas?
Thanks, smuzz
|
|
|
Current Time: Wed Oct 08 15:48:27 PDT 2025
Total time taken to generate the page: 0.00379 seconds