Skip to content

Latest commit

 

History

History
15 lines (12 loc) · 4.77 KB

overview.md

File metadata and controls

15 lines (12 loc) · 4.77 KB

Sweet-Breu LT. Using ChatGPT to quantify land use/land cover changes between two qualitative rasters.

Overview

Land use and land cover (LULC) data are a useful proxy for representing the earth’s surface, and they have applications in ecological, climate, and urban planning research, among many other fields. In particular, LULC data are often used in earth systems models to inform land-atmosphere interactions and biogeochemical cycles. With the certainty of ongoing global climate change, it is important to use these earth system models to understand how this climate will change, and accordingly future projections of LULC data are necessary. Understanding past and current trends of LULC change is vital to predicting future LULC, but quantifying such trends is difficult due to the spatial complexity and computational requirements for comparing LULC data. One tool to quantify these changes is available via ArcGIS Pro’s “Compute Change Raster” function, but this tool is not publicly available, is computationally expensive, and difficult to repeat in multiple discrete study areas. To find a more reproducible and accessible method for quantifying LULC changes, I used ChatGPT to aid in the development of modular code in the R coding language. My primary goal was to determine whether ChatGPT could solve complicated coding problems and produce reproducible and modular code. Additionally, I sought to understand if ChatGPT could act like a software engineer to solve a singular, well-defined problem. Using tips on prompting ChatGPT from Merow et al. (2023) and Perkel (2023), I planned to iteratively instruct ChatGPT to produce functional code to quantify changes between two LULC rasters covering the urban area of San Antionio, Texas from 2016 and 2019 and produce a CSV file with counts of transitions from each land use type to each land use type. Every response and code snippet from ChatGPT was saved to a .txt and .R file, respectively. I intended to iterate with ChatGPT either until the code worked as intended or the effort proved too great for the time needed to achieve the desired result. I hypothesized that the problem would be too complex for ChatGPT to solve, and I would have to move forward with the tool from ArcGIS Pro. However, only one detailed query to ChatGPT was needed to produce working code that functioned as well as the ArcGIS Pro tool. After ensuring that the two processes were comparing the same rasters, the results from each were almost identical. In some cases, the R code counted less transitions for a given class to another class than ArcGIS Pro, but the differences were within an acceptable order of magnitude. I also tested the two processes on a smaller portion of San Antonio where I could better ground-truth the results, and they produced identical results. Thus, I tentatively conclude that ChatGPT found a solution to a problem I originally thought was much more complicated. The R code produced only works if the two rasters being compared have exactly the same dimensions, and it does not produce a change raster like the ArcGIS Pro tool does. Despite this, if only counts are needed and not the spatial location of transitions, then the R code works well and is more defensible methodologically than the ArcGIS Pro tool. This case study shows that ChatGPT can assist in solving problems that are or seem complicated, and it can be beneficial when given a well-defined prompt and precise expectations for methodology and outputs. All associated files can be found at https://github.com/levisweetbreu/bio5100_lulcc/tree/main.

References

  1. Flato, G. M. Earth system models: An overview. WIREs Climate Change, 2(6), 783–800., https://doi.org/10.1002/wcc.148 (2011)
  2. Hurtt, G. Quantification of land-use/land cover change as driver of earth system dynamics. Final technical report (DOE-UMD-12972, 1523270; p. DOE-UMD-12972, 1523270). https://doi.org/10.2172/1523270 (2019)
  3. ESRI. Compute Change Raster (Image Analyst). From https://pro.arcgis.com/en/pro-app/latest/tool-reference/image-analyst/compute-change-raster.htm
  4. R Core Team. 2024. R: A Language and Environment for Statistical Computing. From https://www.r-project.org/
  5. Castelvecchi D. 2022. Are ChatGPT and AlphaCode going to replace programmers? Nature. https://www.nature.com/articles/d41586-022-04383-z
  6. Foroumandi E, Moradkhani H, Sanchez-Vila X, Singha K, Castelletti A, & Destouni G. 2023. ChatGPT in Hydrology and Earth Sciences: Opportunities, Prospects, and Concerns. Water Resources Research, 59(10). https://doi.org/10.1029/2023WR036288
  7. Merow C, Serra-Diaz, JM, Enquist, BJ, & Wilson AM. 2023. AI chatbots can boost scientific coding. Nature Ecology & Evolution. https://doi.org/10.1038/s41559-023-02063-3
  8. Perkel JM. 2023. Six tips for better coding with ChatGPT. Nature. https://doi.org/10.1038/d41586-023-01833-0