MODIS Top of Atmosphere Reflectence

64 views
Skip to first unread message

Lloyd Hughes

unread,
Sep 22, 2022, 9:54:49 AM9/22/22
to pytroll
Hi,

I have a set of MODIS Aqua Level 1B imagery which I want to geo-code and convert top of atmosphere reflectances (no atmospheric correction). How can this be achieved with satpy - if at all? Or do I need to resort to processing the imagery myself using SeaDASS?

Thanks

David Hoese

unread,
Sep 22, 2022, 11:30:16 AM9/22/22
to pyt...@googlegroups.com
Hi Lloyd,

You should be able to use the `modis_l1b` reader in Satpy and load any of the reflectance bands. By default and if not stated otherwise in a reader's documentation, Satpy readers typically don't apply any additional normalizations or corrections when loading band data from a file. Readers for level 1b data do usually apply calibration coefficients to convert "counts" or radiances to brightness temperatures or "reflectances". What these reflectances actually mean or represent depends on the reader. For MODIS L1b they will not have the `/ cos(SZA)` calculation applied to them to make them true reflectances. Other readers like VIIRS SDR already have this calculation applied in the file data so Satpy does not undo it.

If you want/need this `/ cos(SZA)` calculation applied to the data you want to use you *should* be able to do:

scn = Scene(reader="modis_l1b", filenames=[...])
scn.load(["1", "2"], modifiers=("sunz_corrected",))
# additional Satpy stuff you want to do

This "sunz_corrected" portion tells Satpy to apply a "Modifier" to the data being loaded. Hope this helps.

Note this entire conversation of what is a reflectance and what should Satpy do by default is an ongoing conversation in the community and something we are having trouble getting a concrete answer to and that makes everyone happy.

Dave
> --
> You received this message because you are subscribed to the Google Groups "pytroll" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pytroll+u...@googlegroups.com <mailto:pytroll+u...@googlegroups.com>.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/pytroll/bf0e2b79-15a8-4797-8a8a-8aae2af8bdd2n%40googlegroups.com <https://groups.google.com/d/msgid/pytroll/bf0e2b79-15a8-4797-8a8a-8aae2af8bdd2n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Lloyd Hughes

unread,
Sep 23, 2022, 4:45:09 AM9/23/22
to pytroll
Great, thanks for the info David – I will try that out and see if it works as expected for me.

Lloyd Hughes

unread,
Oct 13, 2022, 8:36:23 AM10/13/22
to pytroll
Calling:
scn.load(["1", "2"], modifiers=("sunz_corrected",))
does not change the value of the reflectances returned by Satpy. It is equivalent to:
scn.load(["1", "2"])

Looking into Scene load implementation it appears that the modifiers argument doesn't do anything – even if I put giberish in the argument there are no complaints. Given this, what is the correct manner to apply a modifier?



On Thursday, 22 September 2022 at 17:30:16 UTC+2 dho...@gmail.com wrote:

David Hoese

unread,
Oct 13, 2022, 9:37:49 AM10/13/22
to pyt...@googlegroups.com
Lloyd,

I'm...beyond confused. You are absolutely correct. We should have tests for this. For now, here is a simple slightly-harder way of requesting channel 1 with the sunz modifier:

In [9]: from satpy import DataQuery

In [10]: scn = Scene(reader='modis_l1b', filenames=glob("/data/satellite/modis/input_modis_test1/*.hdf"))

In [11]: scn.load([DataQuery(name="1", modifiers=("sunz_corrected",))])

You can have more than one DataQuery object in the list so should be able to request band 1 and band 2 with the sunz modifier with two DataQuery objects.

I'll file a github issue about this huge bug.

Dave
> > To view this discussion on the web, visit https://groups.google.com/d/msgid/pytroll/bf0e2b79-15a8-4797-8a8a-8aae2af8bdd2n%40googlegroups.com <https://groups.google.com/d/msgid/pytroll/bf0e2b79-15a8-4797-8a8a-8aae2af8bdd2n%40googlegroups.com> <https://groups.google.com/d/msgid/pytroll/bf0e2b79-15a8-4797-8a8a-8aae2af8bdd2n%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/pytroll/bf0e2b79-15a8-4797-8a8a-8aae2af8bdd2n%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> You received this message because you are subscribed to the Google Groups "pytroll" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pytroll+u...@googlegroups.com <mailto:pytroll+u...@googlegroups.com>.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/pytroll/4ed582a6-ed1c-4620-8da4-b0d068857353n%40googlegroups.com <https://groups.google.com/d/msgid/pytroll/4ed582a6-ed1c-4620-8da4-b0d068857353n%40googlegroups.com?utm_medium=email&utm_source=footer>.

David Hoese

unread,
Oct 14, 2022, 1:39:27 PM10/14/22
to pyt...@googlegroups.com
This has now been fixed in the main branch of the Satpy repository and will be included in the next release.

Dave

Lloyd Hughes

unread,
Oct 20, 2022, 5:38:58 AM10/20/22
to pytroll
Great, thanks Dave – it seems to be working as expected now. However, the distribution of the reflectances produced doesn't agree with what SeaDAS produces as TOA, any other ideas what might be missing?

Lloyd Hughes

unread,
Oct 20, 2022, 7:44:27 AM10/20/22
to pytroll
Once I added `reader_kwargs={'mask_saturated': True}` and scale the output by 100 the histograms match much better - blue is from Satpy, orange - SeaDAS.
Screenshot 2022-10-20 at 13.42.00.png

David Hoese

unread,
Oct 20, 2022, 10:15:01 AM10/20/22
to pyt...@googlegroups.com
Lloyd,

As you've noticed, Satpy maintainers decided a long time ago to try to make data between readers consistent as much as we could. The decision was made back then that reflectance data should be represented as percent (%) instead of the albedo scale (units="1"). This means reflectance data from Satpy reader generally falls in the range 0-100% rather than 0-1. In the far future I hope that we can do better unit handling in Satpy (thanks to work by the xarray and pint packages) and automatically convert datasets to what the user prefers, but for the moment we are not able to do that.

Dave

On 10/20/22 06:44, Lloyd Hughes wrote:
> Once I added `reader_kwargs={'mask_saturated': True}` and scale the output by 100 the histograms match much better - blue is from Satpy, orange - SeaDAS.
> >>      > To view this discussion on the web, visit https://groups.google.com/d/msgid/pytroll/bf0e2b79-15a8-4797-8a8a-8aae2af8bdd2n%40googlegroups.com <https://groups.google.com/d/msgid/pytroll/bf0e2b79-15a8-4797-8a8a-8aae2af8bdd2n%40googlegroups.com> <https://groups.google.com/d/msgid/pytroll/bf0e2b79-15a8-4797-8a8a-8aae2af8bdd2n%40googlegroups.com <https://groups.google.com/d/msgid/pytroll/bf0e2b79-15a8-4797-8a8a-8aae2af8bdd2n%40googlegroups.com>> <https://groups.google.com/d/msgid/pytroll/bf0e2b79-15a8-4797-8a8a-8aae2af8bdd2n%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/pytroll/bf0e2b79-15a8-4797-8a8a-8aae2af8bdd2n%40googlegroups.com?utm_medium=email&utm_source=footer> <https://groups.google.com/d/msgid/pytroll/bf0e2b79-15a8-4797-8a8a-8aae2af8bdd2n%40googlegroups.com?utm_medium=email&utm_source=footer
> <https://groups.google.com/d/msgid/pytroll/bf0e2b79-15a8-4797-8a8a-8aae2af8bdd2n%40googlegroups.com?utm_medium=email&utm_source=footer>>>.
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups "pytroll" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an email to pytroll+u...@googlegroups.com <mailto:pytroll+u...@googlegroups.com>.
> >> To view this discussion on the web, visit https://groups.google.com/d/msgid/pytroll/4ed582a6-ed1c-4620-8da4-b0d068857353n%40googlegroups.com <https://groups.google.com/d/msgid/pytroll/4ed582a6-ed1c-4620-8da4-b0d068857353n%40googlegroups.com> <https://groups.google.com/d/msgid/pytroll/4ed582a6-ed1c-4620-8da4-b0d068857353n%40googlegroups.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/pytroll/4ed582a6-ed1c-4620-8da4-b0d068857353n%40googlegroups.com?utm_medium=email&utm_source=footer>>.
>
> --
> You received this message because you are subscribed to the Google Groups "pytroll" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pytroll+u...@googlegroups.com <mailto:pytroll+u...@googlegroups.com>.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/pytroll/e72c08fb-2547-4bfe-bfa7-23ebe50f9943n%40googlegroups.com <https://groups.google.com/d/msgid/pytroll/e72c08fb-2547-4bfe-bfa7-23ebe50f9943n%40googlegroups.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages