Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Quantifying Environmental Aspects of the 2022 UK Drought

23GYP042 Coursework 2, Practical 1: Drought-induced changes to vegetation

In  this  exercise  you  will  work  to  quantify  (calculate)  the  impact  of  the  2022  drought through changes that occurred in the state of the vegetation at different study sites, as detected by satellite observations.

In one aspect of the Individual Coursework you extracted an indication of the amount of vegetation at each of your dust source points by sampling an NDVI dataset (Normalised Difference Vegetation Index). The NDVI is an index (between 0 and 1), and while its value is not a direct  measurement of vegetation,  it can be thought of as showing  how green or healthy plant leaves are. NDVI is widely used for large-scale studies of vegetation change.

In the Individual Coursework you manually used a point shapefile to sample a single NDVI file which represented the state of the vegetation in the Texas region on one date.

Part 1: Automatic processing of multiple MODIS data files

To look at NDVI change over time we need to analyse multiple (perhaps  10s or 100s) of NDVI data files, but it is impractical for us to do this many times in a very labour intensive, manual way. Here, you will use Python, a computer script-based technique which is a way to automatically and repeat-run helpful GIS tools. The tools you will run in Python are ArcGIS tools you are already familiar with manually from the Texas study, such as ‘Zonal Statistics as Table’ .

•    Practicing with the Python script in our local region: Leicestershire

A) Set up a new Cwk2 folder in your OneDrive.

B) From Learn, download the NDVI_Part1 folder and place it into Cwk2. In Part1, there are sixteen  MODIS  NDVI  .tif  files  inside 2022_NDVI_tifs,  a  shapefile  of  the  Leicestershire county boundary, and a Python script (23GYP042_batch_raster_zonal_stats.py)

The sixteen files here provide the NDVI values at  16-day  intervals over the period  18th February (Day of Year 049) to 16th  October (DoY 289) for the whole UK. The ‘DoY’ number is shown as part of the filename alongside the year, as in _doy2022049 for the first file.

C) Right click on the 23GYP042_batch_raster_zonal_stats.py script and select “Edit with IDLE”

D) When  the  script  window  opens,  use  the  square  icon  at  the  top-right  to  maximise  the window.

E) Don’t be put-off by the code! With a few edits, this script will soon be working for you.

In the Python code, all the red text is comment text which the program will not read. This is text written to help users understand the code, and comment lines begin with # symbol.

Because we only want to give you a working example of Python, rest assured you will only need to make a few straightforward edits to tailor the code to work on your data.

The comment text highlights four STEPS where you will need to make certain changes.

STEP 1: Here you will need to edit the green text to ensure the written file address points to the precise location of your 2022_NDVI_tifs folder is on your OneDrive.

Note, everyone’s downloaded folder will be in a different location on their OneDrive.

F) To help you, use File Explorer to navigate to where your 2022_NDVI_tifs folder is saved. When you are in the folder (see below), right-click on the 2022_NDVI_tifs folder on the folder address line (see big arrow) and select “Copy address as text” .

G) Go back to the Python code, and in the line below the green text of STEP 1, paste the address text where it says #PASTE FOLDER ADDRESS HERE>

Now carefully edit the green text in the Python script at STEP 1 to match the 2022 folder containing the NDVI data.

The address you enter will need to be exactly correct (e.g. ensure the ‘gy’ name of OneDrive is correct, and use \\ ), but we will test your accuracy later.

H) Next,  to  complete  STEP  2,  first  you  need  to  create  a  new  empty  folder  inside  your 2022_NDVI_tifsfolder and name the new folder 2022_out_tables

Use the process in F again to edit the STEP 2 green text to state the address to your new

2022_out_tables

I)  For STEP 3, you need to edit the address text to point to your Leicestershire_county.shp shapefile, which defines the area to be sampled.

J) For STEP 4, follow the instructions in the red comments to edit the green text in the outTable line.

K) After STEP 4, you are ready to run the script via the Run menu (Run Module), or press the F5 key (and OK to save).

Progress will be shown in the Python Shell window. Watch for the number of rasters being printed on screen, plus, all the raster names in a long list.

You will see the following when the script has finished running.

Note: Problems CAN occur with scripts and there is a strong chance your script may need

some de-bugging. The syntax of the script has to be exact. Once it is working, however, this script is very convenient as it allows large amounts of data to be analysed quickly, and when set up correctly once, will always run reliably for you.

The output will be 16 tables generated into your 2022_out_tables folder. The last stage is that these individual outputted tables now need to be merged into a single table.

In ArcGIS, run the Merge tool manually from the Data Management >> General toolbox.

Make sure you add all the individual tables and name a sensible output table such as

2022_NDVI_Leics_all

Make sure to specify the filetype as "Table" in the "Save as type" dialog, and a .dbf ending to the output table filename is required.

L) When the merge is complete, the resulting _all.dbf table can be opened in Excel  as a dBase (.dbf) file. Open  Excel and  browse to the _all.dbf file  … make  sure  you  are looking for files of dBase type (not Excel files). As soon as you open the file, ‘Save As’ the file immediately to put it into a normal Excel .xlsx form.

M) Check some of the mean NDVI numbers you see with your group members to see if your values are the same as theirs. They should be! You can also create a quick Excel plot to see how the mean NDVI changed through the year in Leicestershire.

Part 2: Individual study area selection

In the above example we examined NDVI change during part of 2022 in Leicestershire. For the group project, each group member will have the responsibility of looking at the NDVI change experienced within a different vegetation study area inside the UK climate district your group has been assigned.

Looking at column  1  in  the  table  below,  you  can  see there  are four different types of vegetation study area for this project. In terms of the analysis, there is no difference who selects which type of study area so in your group, agree on one type of study area to each group member. (Groups with three people only need to pick any three of the four vegetation sites). Note the person responsible in column 2 below.

1. Type of

vegetation

study area

2. Group

member

responsible

3. Shapefile name

4. Name of chosen vegetation study area

County

Veg Areas  counties.shp

National Park or Area of

Natural Beauty (AONB)

Veg_Areas_NationalParks.shp Veg_Areas_AONB.shp

National Trust land

Veg_Areas_NT_Land_open.shp Veg_Areas_NT_Land_limited.shp

Ancient

Woodland site

Veg_Areas_Ancient_Woodland.shp

A)  Download the NDVI_Part2 files folder from Learn, and from inside it, open the Met_Office_Climate_Districts shapefile in ArcGIS.

Open the attribute table and select your group’s climate district, then right click on the climate districts shapefile in the Table of Content window and Data >> Export Data with a sensible .shp name for your district.

B)  Next from NDVI_Part2 open the Veg_Areas shapefile for the vegetation study area you have responsibility for (see column 3 in table above).

To use in the Python script, you need to isolate one polygon from your Veg_Areas shapefile. For some area types like County or National Parks, the choices will be limited.

For the Ancient Woodland shapefiles, use (menu) Selection >> Select by Location and use your group climate district to select only the polygons in your district  and export these, to help narrow down your choice.

You can find information about any polygon (such as its name and some details) by using the Identify tool from the menu. At the top of the Identify box, make sure the “Identifying from:” is the Veg_Area shapefile you require.

Take a minute or so here to choose your polygon. Any polygon will work, but ask the opinion of your team mates about the polygon you will select. You may want to add in (any) one of the 2022 NDVI .tif files to get a feel for the study area polygons’ size versus the spatial resolution of the NDVI data (250 m).

C)  To  select  and  export  your  chosen  polygon,  first  right  click  on  your  Veg_Areas shapefile  in  the  Table  of  Contents  and  >>  Selection  >>  Make  This  The  Only Selectable Layer.

Use the Selection tool icon from the menu to highlight the polygon, then right click on the shapefile name and export it, with a suitable new .shp name. This shapefile will be the one used in the Python code.

Keep a record of the name of each person’s study site in column 4 of the table.

D)  You can now adapt the Python script (at STEPS 2,3,4) and then run it again to swiftly quantify NDVI change in 2022 for your chosen vegetation study area.

Part 3: Comparing the NDVI change in 2022 to other years

Download NDVI_Part3 and you will see there are different years of NDVI data.

You will be able to use these other years to determine:

a. the difference in NDVI pattern between the 2022 drought summer versus 2021 (the year before)

b. the difference in NDVI pattern between the 2022 drought summer and a longer-term average made up of the average of three years (2005, 2010, 2015).

Again, only minor changes to STEPS 1 and 2 on the Python script need to be adjusted to run each different year and output the NDVI statistics.

Part 4: Calculation of NDVI from Landsat data

One  of  the  benefits  of  using  the  pre-processed  NDVI  data  products  from  MODIS  (i.e. MOD13Q1) is that the NDVI values come pre-calculated for us. One of the disadvantages is that at 250 m pixel size, the data is spatially coarse.

In the first  practical  in  Week  1,  studying  Etosha  Pan  in  Namibia,  you  briefly  looked  at individual bands of satellite data. Each band represents the detection of electromagnetic radiation in a specific part of the spectrum, and NDVI is calculated by the simple processing of  two  bands,  the   Red  and   Near-Infrared  (NIR)   bands  which  interact  differently  with vegetation. To calculate NDVI we use the following formula:

NDVI = (BandNIR - BandRed) / (BandNIR  + BandRed) (Eq. 1)

For the Landsat 8 and 9 satellites, which both carry the Operational Land Imager (OLI) sensor and are both currently active, NIR is Band 5 and Red is Band 4. So:

NDVI = (Band5 - Band4) / (Band5  + Band4) (Eq. 2)

For this Part, your group is tasked with calculating the NDVI from Landsat for one of your chosen  study  areas  (table  column  1).  This  will  provide  a  higher  spatial  resolution assessment of NDVI and will allow you to tackle the question:

To what extent do NDVI estimates at different spatial resolutions (MODIS versus Landsat) produce different NDVI results?

Your first task as a group, is to decide on the single focus area you will pick. It could be the National Park, or the County, or the Ancient Woodlands that one of your group picked in Part 2.

As you will all use the same shapefile, the responsibility for each individual group member is to calculate the NDVI for a different date.

Use the EarthExplorer platform to search for Landsat 8 or 9 images between 16th   February 2022 and 18th  October 2022. (The guide for downloading from Earth Explorer was in the Week  2  practical  handout,  but  we  are  seeking  Landsat  8-9,  not  Landsat  4-5.)  On  the download, only Bands 4 and 5 are required (Bands 4,3,2 are required for true colour, if of interest).

•    Each group member obtains a different date from the period

Group member

Landsat date

•    Use the Raster Calculator tool to calculate NDVI via Equation 2

•    Use the Extract by Mask tool to cut out the NDVI image according to the study shapefile you are using

P.S. For Part 1, here is a link to a helpful calendar for converting DoY to actual date.

https://landweb.modaps.eosdis.nasa.gov/browse/calendar.html