Skip to content

ssj-delta-cu/ssj-data-viz

Repository files navigation

Maps and other visualizations in the SSJ projects

Graphs are in repository ssj-graphs-r - this is for other data visualization.

Usage

Spatial Comparisons

Spatial comparisons can be generated by running the generate_spatial_comparisons.py script. This script will output the mean and standard deviation rasters to a folder you specify, but will not generate the map. The map must be generated manually using the mxd in /outputs/mxds/spatial_comparisons.mxd

Adding new data to the spatial comparisons

The data involved in the spatial comparison is defined near the top of generate_spatial_comparisons.py in the variable rasters. If you want to change the rasters used for any year's spatial comparisons, find the the year and add or remove rasters from the list associated with it. To add a new year for processing, add a new key based on the year, and add a list of rasters to be processed for that year. Paths are relative to /spatial_comparisons in this repository, and any rasters listed should be placed in that folder.

Caveats

For some reason, every other time I run the code, it seems to crash with error 999999. Run it again and it should complete. We haven't had time to dig into why, but I suspect it's an ArcGIS issue somewhere.

Handling the masking of data to crops

The code theoretically auto-masks to the DSA and to crops so that the comparisons display as best as possible, but there are, of course, caveats. For any new year, you'll need to add a key to the land use dictionary with the path to the land use raster for that year. Make sure to provide the path to the band of the raster that has the appropriate codes. If land use codes change in a new year, update the land_use_mask_query to properly subset to the current codes. The query defines which codes to exclude, not include, and applies to all years, as currently constructed.

Additionally, due to environment/version issues, the land use mask wouldn't generate in the same version of Python that was capable of running the rest of the code, so there is a flag use_backup_masks - try setting this to False first and see if the code completes. If it doesn't, you can manually generate new masks using a different version of Python using the unittest in test_spatial_comparisons.py named MaskTest, and then add the outputted mask to the backup_masks dictionary.