vandeynze / salmon_ag

A project examining temporal and spatial interfaces between Pacific salmon and agriculture.
2 stars 1 forks source link

Memory issues when looping over esu_dps for mapping #2

Open lpfeif opened 3 years ago

lpfeif commented 3 years ago

I tried this several different ways: -for loop in R file -for loop in Rmd file (I'm not sure why this would be different, but it seemed to try to hold even more in memory.) -lapply

I think I'll just run it one at a time and paste into a word file so we have some things to look at? Then we can make a plan of what we actually NEED to map in the Rmd.

vandeynze commented 3 years ago

Is this from salmon_agmaps_loop.Rmd? I'm taking a look and yeah not getting the map to plot even once after 20+ min of spinning. I did add some labels and theming so they will be prettier when they do plot properly.

vandeynze commented 3 years ago

Another idea I had this morning: could we reduce the size in memory by dropping the parts of the CDL raster we don't care about? That is, can we filter out the "non-crop" pixels so we're only plotting the ag land? That might shrink the raster size in memory quite a bit. "No-pixel" would then be "other", if that makes sense. Might be worth a shot.

lpfeif commented 3 years ago

Yes, if that's possible it could work! We were filtering by spatial extent before, right, so I don't have experience dropping pixels by field.