edwardbair / SPIRES

Snow property inversion from remote sensing (SPIReS)
MIT License
17 stars 3 forks source link

fails for Landsat 8 SR Collection 2 #6

Open Timbo-Stillinger opened 3 years ago

Timbo-Stillinger commented 3 years ago

https://github.com/edwardbair/SPIRES/blob/aa07fa9b9352f1bd3fb8eebd7a4e3edbae9c8fd4/getOLIsr.m#L32

See my email on our CC offset stuff for snowpex. I think this is causing the issue....

DozierJeff commented 3 years ago

We should not continue to use mstruct's. The ProjectedCRS and GeographicCRS fields in the updated raster reference object, introduced in R2020b, provide a more logical way to handle projections. It does require that running code on a machine whose MATLAB is older include some work-arounds, hence the if verLessThan('map','5.0') in some of the Examples in the RasterReprojection toolbox along with checking for the fields in the rasterReference objects. The readgeoraster function returns these as part of the raster reference output, so geotiffread is no longer recommended.

From: Timbo @.> Sent: Friday, June 25, 2021 18:08 To: edwardbair/SPIRES @.> Cc: Subscribed @.***> Subject: [edwardbair/SPIRES] fails for Landsat 8 SR Collection 2 (#6)

https://github.com/edwardbair/SPIRES/blob/aa07fa9b9352f1bd3fb8eebd7a4e3edbae9c8fd4/getOLIsr.m#L32https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fedwardbair%2FSPIRES%2Fblob%2Faa07fa9b9352f1bd3fb8eebd7a4e3edbae9c8fd4%2FgetOLIsr.m%23L32&data=04%7C01%7C%7C348db54e67b442cdd8e308d9383ed0a9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637602664706105311%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=qGlXDZIHRQEK1pl3P2oxgC9fLDOijACDPowLEnvAue0%3D&reserved=0

See my email on our CC offset stuff for snowpex. I think this is causing the issue....

- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fedwardbair%2FSPIRES%2Fissues%2F6&data=04%7C01%7C%7C348db54e67b442cdd8e308d9383ed0a9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637602664706115265%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=b%2FO955By8iuhfTVLxAgT8yzlo8VzVcrAqqxal1IXQ48%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAB7OA6AD5OL24QJDMQIUOT3TUUR6FANCNFSM47KZZ5JA&data=04%7C01%7C%7C348db54e67b442cdd8e308d9383ed0a9%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637602664706115265%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=mfTwCpNSNrbspF5RXFtWOV%2Bl41xac2HiMPdCGKkcvD4%3D&reserved=0.

edwardbair commented 3 years ago

@Timbo-Stillinger Oops, I found that problem too, but I didn't push the changes to GitHub. I just pushed them so see the updated code for getOLIsr where it gets the null values from the QA flags. It could still be the issue, although I think I re-ran all the R & R0s images using the updated getOLIsr.

@DozierJeff Agree about moving away from the mstructs

Timbo-Stillinger commented 3 years ago

@edwardbair i'll pull down the latest SPIReS code with all your changes and debug with that. Either this weekend or early next week.

@DozierJeff yes - we should revamp. At a certain point, we can also stop worrying about compatibility with older versions.

mjbrodzik commented 3 years ago

Being a relatively recent Matlab user, I have used mstructs based on old code that Karl provided me. I know you guys are all experts. Can you give me a few pointers on what to do when I upgrade to R2020b? (I'm still using 2019). In particular, @DozierJeff: you refer to the "updated raster reference object"--can you let me know what that's called (a pointer to page with specific information is fine, too, if there is such a thing for the new R2020b)? And I'm pretty sure that I've been using geotiffread so I can also upgrade to readgeoraster. Any other recommendations? Summer is a good time for me to do maintenance like this.

DozierJeff commented 3 years ago

Hi Mary Jo. As long as you're upgrading, you might as well go to R2021a. MATLAB upgrades twice a year, March and September.

Now to your questions: In R2020b, MATLAB introduced "CRS" --- coordinate reference system --- and they include this field in the raster reference objects. A map raster reference includes now a ProjectedCRS field, which includes a GeographicCRS field. Similarly, a geographic raster reference includes a GeographicCRS field directly. See the MATLAB documentation for the functions projcrs and geocrs to see the various options to create them. Some options come from espg.org, which you're probably familiar with, but check otherwise.

Also note that the use of raster reference objects is encouraged, instead of referencing matrices. The documentation for makerefmat now comments, "makerefmat will be removed in a future release. Create a raster reference object using the georefcells, georefpostings, georasterref, maprefcells, maprefpostings, or maprasterref function instead."

Attached are a set of my functions to create projcrs for a variety of projections we use. Attached in a separate email is my RasterReprojection toolbox, which handles projections differently depending on whether your Mapping Toolbox is version 5.0 or later. You install toolboxes in MATLAB by putting the .mltbx file somewhere (you don't need to save it afterward) and double-clicking on it. But before you do that, go to Preferences in MATLAB and click Add-Ons to tell your system where you want toolboxes installed. The RasterReprojection.mltbx is 13 MB because of the Examples.

Jeff

From: Mary Jo Brodzik @.> Sent: Monday, June 28, 2021 07:50 To: edwardbair/SPIRES @.> Cc: Jeff Dozier @.>; Mention @.> Subject: Re: [edwardbair/SPIRES] fails for Landsat 8 SR Collection 2 (#6)

Being a relatively recent Matlab user, I have used mstructs based on old code that Karl provided me. I know you guys are all experts. Can you give me a few pointers on what to do when I upgrade to R2020b? (I'm still using 2019). In particular, @DozierJeffhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FDozierJeff&data=04%7C01%7C%7Cde24528aa8e0488e347308d93a440904%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637604886152236051%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2FtCp9350TdkVgwoqgdD3WwpLADif8PEbwZqgB74%2BKRk%3D&reserved=0: you refer to the "updated raster reference object"--can you let me know what that's called (a pointer to page with specific information is fine, too, if there is such a thing for the new R2020b)? And I'm pretty sure that I've been using geotiffread so I can also upgrade to readgeoraster. Any other recommendations? Summer is a good time for me to do maintenance like this.

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fedwardbair%2FSPIRES%2Fissues%2F6%23issuecomment-869750308&data=04%7C01%7C%7Cde24528aa8e0488e347308d93a440904%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637604886152236051%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=GNe%2FO38jsLsBSQA9h3tOhbRrIdNJ%2BXNlKBiUQK6KFCs%3D&reserved=0, or unsubscribehttps://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAB7OA6BFBY5HWULTSPS2N5TTVCD2FANCNFSM47KZZ5JA&data=04%7C01%7C%7Cde24528aa8e0488e347308d93a440904%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637604886152246007%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=srqZihp9AIWD7qLnG64Ih4iuplE%2BoUyjAeDNtVvE%2FeI%3D&reserved=0.