firelab / viirs_ba

Python code for burned area estimation using VIIRS scenes.
Creative Commons Zero v1.0 Universal
7 stars 4 forks source link

Add geographic window to processing. #9

Closed bnordgren closed 8 years ago

bnordgren commented 8 years ago

Thinking that eliminating mexico and canada will speed things up.

calbury commented 8 years ago

Unfortunately, the way I have this built, all the thresholding takes place before attaching the coordinates… unless you have a clever idea there. Once you hit the database filtering would be pretty easy. Want me to start on that?

[Forest Service Shield]

Carl Albury Remote Sensing Specialist

Forest Service Contractor Remote Sensing Applications Center

p: 801-975-3351 calbury@fs.fed.usmailto:calbury@fs.fed.us

2222 West 2300 South Salt Lake City, UT 84119 www.fs.fed.ushttp://www.fs.fed.us/ [USDA Logo]http://usda.gov/[Forest Service Twitter]https://twitter.com/forestservice[USDA Facebook]https://www.facebook.com/pages/US-Forest-Service/1431984283714112

Caring for the land and serving people

From: bnordgren [mailto:notifications@github.com] Sent: Friday, March 04, 2016 12:46 PM To: firelab/viirs_ba viirs_ba@noreply.github.com Subject: [viirs_ba] Add geographic window to processing. (#9)

Thinking that eliminating mexico and canada will speed things up.

— Reply to this email directly or view it on GitHubhttps://github.com/firelab/viirs_ba/issues/9.

This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.

bnordgren commented 8 years ago

I'll probably try it this afternoon. Will likely try adding the window code in the following places:

I assume (haven't looked yet) that the latitude and longitude arrays are the same shape as the scene data arrays (AfArray, M09ReflArray...) ?

Doing this to try and limit the number of rows in the database tables, making the queries faster, so need to catch it before the database if possible.

calbury commented 8 years ago

Actually you could do it at thresholding, just set a threshold that LatArray < 49 and LatArray > 31. That would cut off southern Texas, but I don’t think that would impact the calibration.. I’ll fiddle with this. I’m home sick, but I think I can make something work.

[Forest Service Shield]

Carl Albury Remote Sensing Specialist

Forest Service Contractor Remote Sensing Applications Center

p: 801-975-3351 calbury@fs.fed.usmailto:calbury@fs.fed.us

2222 West 2300 South Salt Lake City, UT 84119 www.fs.fed.ushttp://www.fs.fed.us/ [USDA Logo]http://usda.gov/[Forest Service Twitter]https://twitter.com/forestservice[USDA Facebook]https://www.facebook.com/pages/US-Forest-Service/1431984283714112

Caring for the land and serving people

From: bnordgren [mailto:notifications@github.com] Sent: Friday, March 04, 2016 2:08 PM To: firelab/viirs_ba viirs_ba@noreply.github.com Cc: Albury, Carl -FS calbury@fs.fed.us Subject: Re: [viirs_ba] Add geographic window to processing. (#9)

I'll probably try it this afternoon. Will likely try adding the window code in the following places:

I assume (haven't looked yet) that the latitude and longitude arrays are the same shape as the scene data arrays (AfArray, M09ReflArray...) ?

Doing this to try and limit the number of rows in the database tables, making the queries faster, so need to catch it before the database if possible.

— Reply to this email directly or view it on GitHubhttps://github.com/firelab/viirs_ba/issues/9#issuecomment-192467079.

This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.

calbury commented 8 years ago

Yep, adding a threshold works (see highlighted bits below). I only tested on a couple of images, and didn’t compare times, but it should help. Carl

    BaCon[
        (LatArray < 49) &
        (LatArray > 31) &
        (M07ReflArray < M07UB) &
        (M08ReflArray > M08LB) &
        (M08ReflArray < M08UB) &
        (M10ReflArray > M10LB) &
        (M10ReflArray < M10UB) &
        (M11ReflArray > M11LB) &
        (np.where(M11ReflArray != 0,((M08ReflArray-RthSub)/M11ReflArray),RthLB-1) >= RthLB) &
        (np.where(M11ReflArray != 0,((M08ReflArray-RthSub)/M11ReflArray),Rth+1) < Rth) &
        (AfArray == 5) &
        (SolZen750 < MaxSolZen) &   #this should supress nigth pixels
        ((M07ReflArray - M07ReflFact[1])/M07ReflFact[0] < 65528) &
        ((M08ReflArray - M08ReflFact[1])/M08ReflFact[0] < 65528) &
        ((M10ReflArray - M10ReflFact[1])/M10ReflFact[0] < 65528) &
        ((M11ReflArray - M11ReflFact[1])/M11ReflFact[0] < 65528)
        ] = 1

        # Get the coordinates of any active fire pixels using a the same method as
        # the burned area.
        # Cast any pixels as one that are active fire
        AfCon[
            (LatArray < 49) &
            (LatArray > 31) &
            (AfArray >= 7) &
            (AfArray <= 9)
            ] = 1

        # Get the coordinates of any active fire pixels using a the same method as
        # the burned area.
        # Cast any pixels as one that are active fire
        AfCon[
            (Lat375Array < 49) &
            (Lat375Array > 31) &
            (Af375Array >= 7) &
            (Af375Array <= 9)
            ] = 1

[Forest Service Shield]

Carl Albury Remote Sensing Specialist

Forest Service Contractor Remote Sensing Applications Center

p: 801-975-3351 calbury@fs.fed.usmailto:calbury@fs.fed.us

2222 West 2300 South Salt Lake City, UT 84119 www.fs.fed.ushttp://www.fs.fed.us/ [USDA Logo]http://usda.gov/[Forest Service Twitter]https://twitter.com/forestservice[USDA Facebook]https://www.facebook.com/pages/US-Forest-Service/1431984283714112

Caring for the land and serving people

From: Albury, Carl -FS Sent: Friday, March 04, 2016 2:48 PM To: 'firelab/viirs_ba' reply@reply.github.com; firelab/viirs_ba viirs_ba@noreply.github.com Subject: RE: [viirs_ba] Add geographic window to processing. (#9)

Actually you could do it at thresholding, just set a threshold that LatArray < 49 and LatArray > 31. That would cut off southern Texas, but I don’t think that would impact the calibration.. I’ll fiddle with this. I’m home sick, but I think I can make something work.

[Forest Service Shield]

Carl Albury Remote Sensing Specialist

Forest Service Contractor Remote Sensing Applications Center

p: 801-975-3351 calbury@fs.fed.usmailto:calbury@fs.fed.us

2222 West 2300 South Salt Lake City, UT 84119 www.fs.fed.ushttp://www.fs.fed.us/ [USDA Logo]http://usda.gov/[Forest Service Twitter]https://twitter.com/forestservice[USDA Facebook]https://www.facebook.com/pages/US-Forest-Service/1431984283714112

Caring for the land and serving people

From: bnordgren [mailto:notifications@github.com] Sent: Friday, March 04, 2016 2:08 PM To: firelab/viirs_ba viirs_ba@noreply.github.com<mailto:viirs_ba@noreply.github.com> Cc: Albury, Carl -FS calbury@fs.fed.us<mailto:calbury@fs.fed.us> Subject: Re: [viirs_ba] Add geographic window to processing. (#9)

I'll probably try it this afternoon. Will likely try adding the window code in the following places:

I assume (haven't looked yet) that the latitude and longitude arrays are the same shape as the scene data arrays (AfArray, M09ReflArray...) ?

Doing this to try and limit the number of rows in the database tables, making the queries faster, so need to catch it before the database if possible.

— Reply to this email directly or view it on GitHubhttps://github.com/firelab/viirs_ba/issues/9#issuecomment-192467079.

This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.

calbury commented 8 years ago

I forgot to answer your question, yes the Lat/Lon arrays are the same shape as the scene arrays. Carl

[Forest Service Shield]

Carl Albury Remote Sensing Specialist

Forest Service Contractor Remote Sensing Applications Center

p: 801-975-3351 calbury@fs.fed.usmailto:calbury@fs.fed.us

2222 West 2300 South Salt Lake City, UT 84119 www.fs.fed.ushttp://www.fs.fed.us/ [USDA Logo]http://usda.gov/[Forest Service Twitter]https://twitter.com/forestservice[USDA Facebook]https://www.facebook.com/pages/US-Forest-Service/1431984283714112

Caring for the land and serving people

From: bnordgren [mailto:notifications@github.com] Sent: Friday, March 04, 2016 2:08 PM To: firelab/viirs_ba viirs_ba@noreply.github.com Cc: Albury, Carl -FS calbury@fs.fed.us Subject: Re: [viirs_ba] Add geographic window to processing. (#9)

I'll probably try it this afternoon. Will likely try adding the window code in the following places:

I assume (haven't looked yet) that the latitude and longitude arrays are the same shape as the scene data arrays (AfArray, M09ReflArray...) ?

Doing this to try and limit the number of rows in the database tables, making the queries faster, so need to catch it before the database if possible.

— Reply to this email directly or view it on GitHubhttps://github.com/firelab/viirs_ba/issues/9#issuecomment-192467079.

This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.