Assignment 4

The total grade of the assignment will be divided in this way:

  • 20% - Task 1
  • 70% - Task 2, sections 2-7
  • 10% - Task 2, sections 8 and 9

Submission instructions

This assignment is due by 11:59 pm on Saturday, November 23. All tasks for this assignment should be submitted via Gradescope. Make sure you double-check your submission to ensure it satisfies all the items in these checklists:

  • File formatting and uploading:
  • Notebook PDF content checklists:

Resubmissions after the due date due to not satisfying one of the checks above will be strictly held to the course’s 50%-regrade resubmission policy (see syllabus).

If you have any questions about assignment logistics, please reach out to the TA or instructor by 5 pm Friday, November 22.

There is a separate gradescope assignment for task 2, section 7 (GitHub repository). For this submission, you will need to link your whole GitHub repository.

To convert your notebook to PDF, we will first convert your notebook to HTML, and then save as PDF.

  1. Open your notebook in VS code.

  2. Select the three dots at the top of your notebook.

  1. Select Export > HTML (not pdf)

  1. Choose where you want to save this HTML to your computer

  2. Open up the html and go to File > Print > Save as PDF

  3. Save your PDF as `hwk4-task2-false-color-YOURLASTNAME.pdf and submit to Gradescope.

Task 1: The politics of pixels reading

When working with satellite data, it’s easy to assume that it is inherently objective and equally accessible to everyone. However, Bennett et al., in their paper The Politics of Pixels: A Review and Agenda for Critical Remote Sensing (2022 [1]), challenge this assumption, arguing that remote sensing needs a critical lens. They emphasize that various sociopolitical factors influence who collects remotely sensed data, how it’s collected, and ultimately, who benefits from its insights. This reading will encourage you to explore the biases and inequalities that can be embedded in remote sensing technologies and practices.

Read the paper and write a one-paragraph (between 100 and 150 words) reflection about it. This paper is a bit denser than the others we’ve read, section V is worth special attention. Review the rubric for this assignment here. Answer at least one of the following questions for your reflection:

  1. Reflecting on your personal or professional background, how might sociopolitical factors shape the availability and interpretation of satellite and other remotely sensed data for communities or organizations you’re familiar with?

  2. What potential ethical responsibilities arise for environmental data scientists when working with remote sensing data that may carry biases or limitations?

  3. If you were tasked with implementing remote sensing for a project, what steps might you take to ensure the data collected is fair, accessible, and unbiased?

Ready to submit your answer? Make sure your submission follows the checklist at the top of the assginment!

Task 2: Visualizing fire scars through false color

In early January 2025, the Eaton Fire and Palisades Fire erupted nearly simultaneously in the foothills and coastal wildland-urban interface zones of Los Angeles County, fueled by powerful Santa Ana winds Together, they devastated thousands of homes, displaced tens of thousands of residents, and inflicted severe ecological and infrastructural damage.

False color imagery, created using satellite data from instruments like Landsat, is a useful tool for monitoring wildfire impacts. By assigning infrared bands to visible colors, these images highlight vegetation health, burn severity, and the extent of fire scars. This approach helps researchers and land managers assess recovery efforts, identify high-risk areas, and plan restoration strategies.

In this task, you will create a false color image of the Eaton and Palisades Fires using remote sensing data, highlighting the fire scar and exploring how coding and data visualization support environmental monitoring.

About the data

In this task you will use two datsets. The first is a simplified collection of bands (red, green, blue, near-infrared and shortwave infrared) from the Landsat Collection 2 Level-2 atmosperically corrected surface reflectance data, collected by the Landsat 8 satellite.

The data was retrieved from the Microsof Planetary Computer data catalogue and clipped to an area surrounding the fire perimeters. This data should be used for visualization and educational purposes only and can be accessed at the landsat8-2025-02-23-palisades-eaton.nc in the course shared data Google Drive.

The second dataset will be fire perimeters for the Eaton and Palisades fires. There are several datasets with this information online. You will need to independently select one from a reputable source (it may be more than one file).

Setup

Create a new GitHub repository named eds220-hwk4. You will need to create one notebooks named hwk4-task2-false-color-YOURLASTNAME.ipynb.

Your repository should have the following structure and include only these files:

eds220-hwk4
│--  README.md
│--  hwk4-task2-false-color-YOURLASTNAME.ipynb
|--  .gitignore

📋 Don’t forget to read the rubric for this task before you start working on it.

Instructions

1. Reading

Read the following resources about false color images and Landsat imagery:

Sections 2 through 5 must be completed in the hwk4-task2-false-color-YOURLASTNAME.ipynb notebook. In this notebook you will be using both your fire perimeter data and the Landsat data landsat8-2025-02-23-palisades-eaton.nc. You may need to complete data wrangling steps beyond the ones described to create the requested outputs.

2. Fire perimeter data exploration

Explore the fire perimeter data and write a brief summary of the information you obtained from the preliminary exploration. Your summary should include, at least, the CRS of the data and whether this is projected or geographic.

3. NetCDF data import and exploration

If you are working on your personal computer: then follow steps a, b, and c to update the EDS-220 conda environment (recommended).

If you are working on workbench-1: the EDS-220 environment is already updated with the netcdf4 package and you can skip steps a, b, and c.

On the terminal:

  1. Activate the EDS 220 conda environment and verify it is active.

  2. Install the netCDF4 package in the EDS 220 environment by running

conda install -c conda-forge netcdf4
  1. Verify that the netcdf4 package was installed.

In your notebook:

  1. Import the Landsat data using xr.open_dataset().

  2. Explore the data and write a brief summary of the information you obtained from the preliminary information. Your summary should include the a description of the data’s variables, dimensions, and coordinates.

4. Restoring geospatial information

  1. Use rio.crs to print what is the CRS of this dataset. Is this a geospatial object?

  2. You may have noticed on section 3 that the geospatial information for this dataset is stored in the variable spatial_ref. Print the CRS by using accesing the spatial_ref.crs_wkt attribute of the dataset.

  3. Recover the geospatial information by using rio.write_crs() and the spatial reference information form part b.

  4. Print the CRS of the updated dataset.

5. True color image

  1. Without creating any new variables:
  • select the red, green, and blue variables (in that order) of the xarray.Dataset holding the Landsat data,
  • convert it to a numpy.array using the to_array() method, and then
  • use .plot.imshow() to create an RGB image with the data. There will be two warnings, that’s ok.
  1. Adjust the scale used for plotting the bands to get a true color image. HINT: Check the robust parameter. The issue here is the clouds: their RGB values are outliers and cause the other values to be squished when plotting.

  2. To resolve the other warning, identify which bands have nan values. HINT: There are many ways of doing so. One option is to use numpy.isnan().

  3. Use the .fillna() mehtod for xarray.Datasets to substitute the any nan values in the Landsat data for zero.

  4. Create a new true color image that gets plotted without warnings.

  5. In a markdown cell write a brief explanation comparing the ouputs for parts (a) and (e).

6. False color image

Without creating any new variables, create a false color image by plotting the short-wave infrared (swir22), near-infrared, and red variables (in that order).

7. Map

  1. Create a map showing the shortwave infrared/near-infrared/red false color image together with both fire perimeters. Customize it appropriately including, at least, an informative title and legend. You may also want to include text on the map to identify which fire is which.

  2. Write a figure description for the map including a brief explanation of how false color imagery is being used.

The rest of the sections are about updating and cleaning your notebooks and repository. This is hugely important! By maintaining clean, well-structured repositories and notebooks, you’re not only showcasing your technical skills but also building a portfolio that reflects your professionalism, attention to detail, and ability to collaborate effectively with others.

Here is an example of an organized repository and notebook based on the oil spills task from homework 3.

8. Clean your notebooks

The target audience for your notebooks is a fellow EDS 220 student who is just learning about wrangling raster data using Python.

  • Add enough and appropriate comments to explain your code.
  • Add enough and appropriate markdown cells to explain the procedures you are using and their output.
  • First cell in the notebook must be a markdown cell including:
  • Each notebook must include an “About” section with the following subsections:

The rest of your notebook should be organized into logical subsections (indicated through markdown headers) for the analysis and visualization you are performing. The subsections should easily guide the reader through the analysis.

9. Update your repository

Update your repository’s README with (at least) the following (based on EDS 296):

Ready to submit your answers? Make sure your submission follows the checklist at the top of the assginment!

References

[1]
M. M. Bennett, J. K. Chen, L. F. Alvarez León, and C. J. Gleason, “The politics of pixels: A review and agenda for critical remote sensing,” Progress in Human Geography, vol. 46, no. 3, pp. 729–752, Jun. 2022, doi: 10.1177/03091325221074691. Available: https://journals.sagepub.com/doi/10.1177/03091325221074691. [Accessed: Nov. 14, 2024]