eqfilter polygon definition

103 views
Skip to first unread message

Victor Preatoni

unread,
Jan 2, 2024, 12:14:58 PMJan 2
to Earthworm Community Forum
Hi,

I am facing a problem with the polygon definition for eqfilter. Some events that fall inside a polygon get discarded.

My definitions from log file are as follows:

Inst 186 - 5 Inclusion regions
Reg 0 (4): [-38.00, -70.80] [-38.00, -71.30] [-37.70, -71.30] [-37.70, -70.80] [-38.00, -70.80]
Reg 1 (4): [-39.80, -71.20] [-39.80, -71.70] [-39.50, -71.70] [-39.50, -71.20] [-39.80, -71.20]
Reg 2 (4): [-36.30, -70.20] [-36.30, -70.70] [-35.90, -70.70] [-35.90, -70.20] [-36.30, -70.20]
Reg 3 (4): [-36.90, -70.10] [-36.90, -70.80] [-36.50, -70.80] [-36.50, -70.10] [-36.90, -70.10]
Reg 4 (4): [-63.10, -60.30] [-63.10, -60.90] [-62.80, -60.90] [-62.80, -60.30] [-63.10, -60.30]
 


And here are a couple of events that clearly would fall inside polygon Reg 2, but are ignored:

Inst 186, coords -36.04, -70.68 ==> not in any InclRegion ==> IGNORING.
Inst 186, coords -36.16, -70.55 ==> not in any InclRegion ==> IGNORING.


Anyone has faced same problem before??. Maybe the problem is with southern latitudes only?.

Thanks,
Victor

Mitchell M Withers (mwithers)

unread,
Jan 2, 2024, 3:52:54 PMJan 2
to Earthworm Community Forum

It works with negative longitudes so should also work with negative latitudes though I'm not sure that's well tested. Does the inst_id for the rejected events match the inst_id of the configured include region? If not, it would be rejected whether in the polygon or not, unless AllowUndefInst is enabled.

Mitch

Center for Earthquake Research and Information (CERI)
University of Memphis
Memphis, TN 38152
901-678-4940

________________________________________
From: earthwo...@googlegroups.com <earthwo...@googlegroups.com> on behalf of Victor Preatoni <vpre...@gmail.com>
Sent: Tuesday, January 2, 2024 11:14 AM
To: Earthworm Community Forum
Subject: [SPAM:###68] [Earthworm Forum] eqfilter polygon definition

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and trust the content is safe.
--
--
You received this message because you are subscribed to the Google
Groups "Earthworm Community Forum" group.

To post to this group, send an email to earthwo...@googlegroups.com

To unsubscribe from this group, send an email to
earthworm_for...@googlegroups.com

For more options, visit this group at
http://groups.google.com/group/earthworm_forum?hl=en<http://groups.google.com/group/earthworm_forum?hl=en>

---
You received this message because you are subscribed to the Google Groups "Earthworm Community Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to earthworm_for...@googlegroups.com<mailto:earthworm_for...@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/earthworm_forum/d09657fb-cdd0-4374-8c35-b2f70826d2ban%40googlegroups.com<https://groups.google.com/d/msgid/earthworm_forum/d09657fb-cdd0-4374-8c35-b2f70826d2ban%40googlegroups.com?utm_medium=email&utm_source=footer>.

Victor Preatoni

unread,
Jan 3, 2024, 9:24:49 AMJan 3
to earthwo...@googlegroups.com
Hi Mitch,

Inst Id matches. In the log I can see that the polygon definitions are for Inst 186 (INST_OAVV), and that the rejected locations arrive with Inst 186 too.

I have faced the same problem before with ewhtmlemail regions, but at that time I thought it was a problem with my configuration. Now that problem arises again, I will do some manual code tests on the geom_area C function defined in geom.c to debug it. Both modules (eqfilter & ewhtmlemail) use the same function.

Will keep group updated on test results.

Thanks!,
Victor

You received this message because you are subscribed to a topic in the Google Groups "Earthworm Community Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/earthworm_forum/IMZetmHFD7g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to earthworm_for...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/earthworm_forum/BYAPR16MB2503E98BEE35850780AB3F44CC61A%40BYAPR16MB2503.namprd16.prod.outlook.com.

Victor Preatoni

unread,
Jan 3, 2024, 11:00:49 AMJan 3
to Earthworm Community Forum
I can confirm there is a bug in geom_area() function used in eqfilter.c and ewhtmlemail.c.
Function is defined in geom.c

Although I have not tested eqfilterII, it uses area.c file, which seems to use the same algorithm as geom.c


Test I have done so far:

Defined a simple C function which tests two different algorithms (Ron Sheen's one and Randolph Franklin's pnpoly https://wrfranklin.org/Research/Short_Notes/pnpoly.html)

C code example:
int main(void)
{
int retval;
int num_sides = 5;
float lat = -36.10;
float lon = -70.00;

float x[] = {-35.90, -35.90, -36.30, -36.30, -35.90};
float y[] = {-70.20, -70.70, -70.70, -70.20, -70.20};


geom_area(&retval, num_sides, x, y, &lat, &lon);
printf("geom_area() reports:\t");
if (retval)
printf("Point inside\n");
else
printf("Point OUTSIDE!\n");


retval = pnpoly(num_sides, x, y, lat, lon);
printf("pnpoly() reports:\t");
if (retval)
printf("Point inside\n");
else
printf("Point OUTSIDE!\n");

exit(0);
}



Results for different test cases:
  • Point exceeding North bounds
geom_area() reports:    Point OUTSIDE!
pnpoly() reports:       Point OUTSIDE!

  • Point exceeding South bounds
geom_area() reports:    Point OUTSIDE!
pnpoly() reports:       Point OUTSIDE!

  • Point exceeding East bounds
geom_area() reports:    Point inside
pnpoly() reports:       Point OUTSIDE!

  • Point exceeding West bounds
geom_area() reports:    Point OUTSIDE!
pnpoly() reports:       Point OUTSIDE!



I will do some further tests on Earthworm source code.

Victor
Reply all
Reply to author
Forward
0 new messages