Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plot method to CDL dataset #415

Merged
merged 2 commits into from
Mar 1, 2022
Merged

Conversation

nilsleh
Copy link
Collaborator

@nilsleh nilsleh commented Feb 20, 2022

Since RasterDatasets should have their own plot method per #253, this PR adds a plot method to the the CDL dataset (data.py is in a separate PR).

Example:
cdl

@github-actions github-actions bot added datasets Geospatial or benchmark datasets testing Continuous integration testing labels Feb 20, 2022
@calebrob6
Copy link
Member

We should use the cmap that comes with the data:

{0: (0, 0, 0, 0), 1: (255, 211, 0, 255), 2: (255, 38, 38, 255), 3: (0, 168, 228, 255), 4: (255, 158, 11, 255), 5: (38, 112, 0, 255), 6: (255, 255, 0, 255), 7: (0, 0, 0, 255), 8: (0, 0, 0, 255), 9: (0, 0, 0, 255), 10: (112, 165, 0, 255), 11: (0, 175, 75, 255), 12: (221, 165, 11, 255), 13: (221, 165, 11, 255), 14: (126, 211, 255, 255), 15: (0, 0, 0, 255), 16: (0, 0, 0, 255), 17: (0, 0, 0, 255), 18: (0, 0, 0, 255), 19: (0, 0, 0, 255), 20: (0, 0, 0, 255), 21: (226, 0, 124, 255), 22: (137, 98, 84, 255), 23: (216, 181, 107, 255), 24: (165, 112, 0, 255), 25: (214, 158, 188, 255), 26: (112, 112, 0, 255), 27: (172, 0, 124, 255), 28: (160, 89, 137, 255), 29: (112, 0, 73, 255), 30: (214, 158, 188, 255), 31: (209, 255, 0, 255), 32: (126, 153, 255, 255), 33: (214, 214, 0, 255), 34: (209, 255, 0, 255), 35: (0, 175, 75, 255), 36: (255, 165, 226, 255), 37: (165, 242, 140, 255), 38: (0, 175, 75, 255), 39: (214, 158, 188, 255), 40: (0, 0, 0, 255), 41: (168, 0, 228, 255), 42: (165, 0, 0, 255), 43: (112, 38, 0, 255), 44: (0, 175, 75, 255), 45: (177, 126, 255, 255), 46: (112, 38, 0, 255), 47: (255, 102, 102, 255), 48: (255, 102, 102, 255), 49: (255, 204, 102, 255), 50: (255, 102, 102, 255), 51: (0, 175, 75, 255), 52: (0, 221, 175, 255), 53: (84, 255, 0, 255), 54: (242, 163, 119, 255), 55: (255, 102, 102, 255), 56: (0, 175, 75, 255), 57: (126, 211, 255, 255), 58: (232, 191, 255, 255), 59: (175, 255, 221, 255), 60: (0, 175, 75, 255), 61: (191, 191, 119, 255), 62: (0, 0, 0, 255), 63: (147, 204, 147, 255), 64: (198, 214, 158, 255), 65: (204, 191, 163, 255), 66: (255, 0, 255, 255), 67: (255, 142, 170, 255), 68: (186, 0, 79, 255), 69: (112, 68, 137, 255), 70: (0, 119, 119, 255), 71: (177, 154, 112, 255), 72: (255, 255, 126, 255), 73: (0, 0, 0, 255), 74: (181, 112, 91, 255), 75: (0, 165, 130, 255), 76: (233, 214, 175, 255), 77: (177, 154, 112, 255), 78: (0, 0, 0, 255), 79: (0, 0, 0, 255), 80: (0, 0, 0, 255), 81: (242, 242, 242, 255), 82: (154, 154, 154, 255), 83: (75, 112, 163, 255), 84: (0, 0, 0, 255), 85: (0, 0, 0, 255), 86: (0, 0, 0, 255), 87: (126, 177, 177, 255), 88: (232, 255, 191, 255), 89: (0, 0, 0, 255), 90: (0, 0, 0, 255), 91: (0, 0, 0, 255), 92: (0, 255, 255, 255), 93: (0, 0, 0, 255), 94: (0, 0, 0, 255), 95: (0, 0, 0, 255), 96: (0, 0, 0, 255), 97: (0, 0, 0, 255), 98: (0, 0, 0, 255), 99: (0, 0, 0, 255), 100: (0, 0, 0, 255), 101: (0, 0, 0, 255), 102: (0, 0, 0, 255), 103: (0, 0, 0, 255), 104: (0, 0, 0, 255), 105: (0, 0, 0, 255), 106: (0, 0, 0, 255), 107: (0, 0, 0, 255), 108: (0, 0, 0, 255), 109: (0, 0, 0, 255), 110: (0, 0, 0, 255), 111: (75, 112, 163, 255), 112: (211, 226, 249, 255), 113: (0, 0, 0, 255), 114: (0, 0, 0, 255), 115: (0, 0, 0, 255), 116: (0, 0, 0, 255), 117: (0, 0, 0, 255), 118: (0, 0, 0, 255), 119: (0, 0, 0, 255), 120: (0, 0, 0, 255), 121: (154, 154, 154, 255), 122: (154, 154, 154, 255), 123: (154, 154, 154, 255), 124: (154, 154, 154, 255), 125: (0, 0, 0, 255), 126: (0, 0, 0, 255), 127: (0, 0, 0, 255), 128: (0, 0, 0, 255), 129: (0, 0, 0, 255), 130: (0, 0, 0, 255), 131: (204, 191, 163, 255), 132: (0, 0, 0, 255), 133: (0, 0, 0, 255), 134: (0, 0, 0, 255), 135: (0, 0, 0, 255), 136: (0, 0, 0, 255), 137: (0, 0, 0, 255), 138: (0, 0, 0, 255), 139: (0, 0, 0, 255), 140: (0, 0, 0, 255), 141: (147, 204, 147, 255), 142: (147, 204, 147, 255), 143: (147, 204, 147, 255), 144: (0, 0, 0, 255), 145: (0, 0, 0, 255), 146: (0, 0, 0, 255), 147: (0, 0, 0, 255), 148: (0, 0, 0, 255), 149: (0, 0, 0, 255), 150: (0, 0, 0, 255), 151: (0, 0, 0, 255), 152: (198, 214, 158, 255), 153: (0, 0, 0, 255), 154: (0, 0, 0, 255), 155: (0, 0, 0, 255), 156: (0, 0, 0, 255), 157: (0, 0, 0, 255), 158: (0, 0, 0, 255), 159: (0, 0, 0, 255), 160: (0, 0, 0, 255), 161: (0, 0, 0, 255), 162: (0, 0, 0, 255), 163: (0, 0, 0, 255), 164: (0, 0, 0, 255), 165: (0, 0, 0, 255), 166: (0, 0, 0, 255), 167: (0, 0, 0, 255), 168: (0, 0, 0, 255), 169: (0, 0, 0, 255), 170: (0, 0, 0, 255), 171: (0, 0, 0, 255), 172: (0, 0, 0, 255), 173: (0, 0, 0, 255), 174: (0, 0, 0, 255), 175: (0, 0, 0, 255), 176: (232, 255, 191, 255), 177: (0, 0, 0, 255), 178: (0, 0, 0, 255), 179: (0, 0, 0, 255), 180: (0, 0, 0, 255), 181: (0, 0, 0, 255), 182: (0, 0, 0, 255), 183: (0, 0, 0, 255), 184: (0, 0, 0, 255), 185: (0, 0, 0, 255), 186: (0, 0, 0, 255), 187: (0, 0, 0, 255), 188: (0, 0, 0, 255), 189: (0, 0, 0, 255), 190: (126, 177, 177, 255), 191: (0, 0, 0, 255), 192: (0, 0, 0, 255), 193: (0, 0, 0, 255), 194: (0, 0, 0, 255), 195: (126, 177, 177, 255), 196: (0, 0, 0, 255), 197: (0, 0, 0, 255), 198: (0, 0, 0, 255), 199: (0, 0, 0, 255), 200: (0, 0, 0, 255), 201: (0, 0, 0, 255), 202: (0, 0, 0, 255), 203: (0, 0, 0, 255), 204: (0, 255, 140, 255), 205: (214, 158, 188, 255), 206: (255, 102, 102, 255), 207: (255, 102, 102, 255), 208: (255, 102, 102, 255), 209: (255, 102, 102, 255), 210: (255, 142, 170, 255), 211: (51, 73, 51, 255), 212: (228, 112, 38, 255), 213: (255, 102, 102, 255), 214: (255, 102, 102, 255), 215: (102, 153, 76, 255), 216: (255, 102, 102, 255), 217: (177, 154, 112, 255), 218: (255, 142, 170, 255), 219: (255, 102, 102, 255), 220: (255, 142, 170, 255), 221: (255, 102, 102, 255), 222: (255, 102, 102, 255), 223: (255, 142, 170, 255), 224: (0, 175, 75, 255), 225: (255, 211, 0, 255), 226: (255, 211, 0, 255), 227: (255, 102, 102, 255), 228: (255, 210, 0, 255), 229: (255, 102, 102, 255), 230: (137, 98, 84, 255), 231: (255, 102, 102, 255), 232: (255, 38, 38, 255), 233: (226, 0, 124, 255), 234: (255, 158, 11, 255), 235: (255, 158, 11, 255), 236: (165, 112, 0, 255), 237: (255, 211, 0, 255), 238: (165, 112, 0, 255), 239: (38, 112, 0, 255), 240: (38, 112, 0, 255), 241: (255, 211, 0, 255), 242: (0, 0, 153, 255), 243: (255, 102, 102, 255), 244: (255, 102, 102, 255), 245: (255, 102, 102, 255), 246: (255, 102, 102, 255), 247: (255, 102, 102, 255), 248: (255, 102, 102, 255), 249: (255, 102, 102, 255), 250: (255, 102, 102, 255), 251: (0, 0, 0, 255), 252: (0, 0, 0, 255), 253: (0, 0, 0, 255), 254: (38, 112, 0, 255), 255: (0, 0, 0, 255)}

@adamjstewart adamjstewart added this to the 0.3.0 milestone Feb 20, 2022
@adamjstewart
Copy link
Collaborator

So while debugging #424, it seems like different years of data for CDL use a different file format. Can you do the same thing in your data.py script? So for one year, create both .tif and .tif.ovr files, and then in another year, create an .img file. This will be a much better test of our globs/regexes.

@adamjstewart
Copy link
Collaborator

Actually, it seems like all versions used to use .img, but all versions were modified to use .tif instead? I'll update the checksums in another PR so we can backport it to 0.2.1. Can you also move all the data.py stuff to a separate PR so we can backport that too?

torchgeo/datasets/cdl.py Outdated Show resolved Hide resolved
calebrob6
calebrob6 previously approved these changes Feb 23, 2022
torchgeo/datasets/cdl.py Show resolved Hide resolved
torchgeo/datasets/cdl.py Outdated Show resolved Hide resolved
@adamjstewart adamjstewart changed the title Add plot method and own data.py to CDL dataset Add plot method to CDL dataset Feb 24, 2022
Copy link
Collaborator

@adamjstewart adamjstewart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you address my follow-up concerns from #429?

tests/datasets/test_cdl.py Outdated Show resolved Hide resolved
@github-actions github-actions bot added documentation Improvements or additions to documentation samplers Samplers for indexing datasets transforms Data augmentation transforms labels Feb 28, 2022
@nilsleh nilsleh closed this Feb 28, 2022
@github-actions github-actions bot removed samplers Samplers for indexing datasets transforms Data augmentation transforms datasets Geospatial or benchmark datasets testing Continuous integration testing documentation Improvements or additions to documentation labels Feb 28, 2022
@nilsleh nilsleh reopened this Feb 28, 2022
@github-actions github-actions bot added datasets Geospatial or benchmark datasets testing Continuous integration testing labels Feb 28, 2022
@adamjstewart adamjstewart merged commit 17792df into microsoft:main Mar 1, 2022
This was referenced Jul 10, 2022
yichiac pushed a commit to yichiac/torchgeo that referenced this pull request Apr 29, 2023
* requested changes

* add colormap to file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datasets Geospatial or benchmark datasets testing Continuous integration testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants