History | Updated Sep 2023 ## Background The TurtleWatch project investigated the overlap between loggerhead sea turtles habitat and fishing effort of the Hawaii-based shallow-set longline fishery in the Pacific Ocean north of the Hawaiian Islands. That fishery, which targets swordfish, used to experience high levels of bycatch of loggerhead turtles. Considerable changes in gear and operations lowered bycatch rate and TurtleWatch was designed as a tool to advise fishermen on areas to avoid to limit bycatch.
Research results indicated that 50% of interactions occurred between 17.5°C and 18.5°C.
Objective
Here we will draw the 17.5 and 18.5ºC temperature contours on a map of satellite sea surface temperature.
The exercise demonstrates the following techniques:
Subsetting and loading data from an ERDDAP server using xarray
Set flag values for features of interest
Plotting maps
Datasets used
CoralTemp Sea Surface Temperature product from the NOAA Coral Reef Watch program. The NOAA Coral Reef Watch (CRW) daily global 5km Sea Surface Temperature (SST) product, also known as CoralTemp, shows the nighttime ocean temperature measured at the surface. The SST scale ranges from -2 to 35 °C. The CoralTemp SST data product was developed from two related reanalysis (reprocessed) SST products and a near real-time SST product. Spanning January 1, 1985 to the present, the CoralTemp SST is one of the best and most internally consistent daily global 5km SST products available. More information about the product: https://coralreefwatch.noaa.gov/product/5km/index_5km_sst.php
Install required packages
import xarray as xr import matplotlib.pyplot as pltimport matplotlib as mpl
Download the SST data
Select a geographical range
Select an area of the central North Pacific where the fishery operates: longitude range of 185 to 235 east and latitude range of 20 to 45 north
Select a date
Select a date in the first quarter of the year when bycatch typically occurs: 2023-01-06
Set variables for the habitat temperature range
# Longitude rangelon_min =185lon_max =235# Latitude rangelat_min =20lat_max =45date_for_sat_data ='2023-01-06'# Turtle habitat temperature rangehab_temp_min =17.5hab_temp_max =18.5
Open the netCDF file to create an xarray dataset object
This product is designed to improve on and replace the use of AVHRR Pathfinder SST for use within the Coral Reef Watch Program.
contributor_name :
NOAA Coral Reef Watch Program
contributor_role :
Collecting source data and deriving products; performing quality control of products; disseminating, storing, and submitting data to archive
Conventions :
CF-1.6, ACDD-1.3, COARDS
creator_email :
coralreefwatch@noaa.gov
creator_institution :
NOAA/NESDIS/STAR Coral Reef Watch Program
creator_name :
NOAA Coral Reef Watch Program
creator_type :
group
creator_url :
https://coralreefwatch.noaa.gov/
data_source :
NOAA Daily Global 5km Geo-Polar Blended Night-only Sea Surface Temperature Analysis from the date specified in the global attribute time_coverage_start. Note, if the text of this global attribute begins with "Due to ...", one of the following situations occurred: (1) the source data file for the CoralTemp of data file for the CoralTemp of the day was missing; (2) the sea_ice_fraction data array in the source data was missing, (3) some alternation was made on the source data to derive the CoralTemp data of the day.
Sat Sep 9 06:30:11 2023: ncatted -O -a geospatial_bounds,global,o,c,"POLYGON((-90.0 360.0, 90.0 360.0, 90.0 0.0, -90.0 0.0, -90.0 360.0))" coraltemp_v3.1_20230908-0-360.nc
Sat Sep 9 06:30:11 2023: ncatted -O -a geospatial_lon_max,global,o,f,359.975 coraltemp_v3.1_20230908-0-360.nc
Sat Sep 9 06:30:11 2023: ncatted -O -a geospatial_lon_min,global,o,f,0.025 coraltemp_v3.1_20230908-0-360.nc
Sat Sep 9 06:30:11 2023: ncatted -O -a valid_max,lon,o,f,359.975 coraltemp_v3.1_20230908-0-360.nc
Sat Sep 9 06:30:11 2023: ncatted -O -a valid_min,lon,o,f,0.025 coraltemp_v3.1_20230908-0-360.nc
Sat Sep 9 06:30:10 2023: ncap2 -O -s where(lon<0) lon=lon+360 coraltemp_v3.1_20230908-0-360.nc coraltemp_v3.1_20230908-0-360.nc
Sat Sep 9 06:30:08 2023: ncks -O --msa_usr_rdr -d lon,0.0,180.0 -d lon,-180.0,0.0 coraltemp_v3.1_20230908.nc coraltemp_v3.1_20230908-0-360.nc
This is the first version of CoralTemp. It was originally called v1.0 and then renamed to v3.1 with no change to the overall product)
2023-09-11T14:46:38Z (local files)
2023-09-11T14:46:38Z https://oceanwatch.pifsc.noaa.gov/erddap/griddap/CRW_sst_v3_1.das
OSTIA Usage Statement (1985-2002): IMPORTANT usage statement. Unless otherwise agreed in writing, these data may be used for pure academic research only, with no commercial or other application and all usage must meet the Met Office Standard Terms and Conditions, which may be found here: https://www.metoffice.gov.uk/corporate/legal/tandc.html. The data may be used for a maximum period of 5 years. Reproduction of the data is permitted provided the following copyright statement is included: (C) Crown Copyright 2010, published by the Met Office. You must submit a completed reproduction license application form (here https://www.metoffice.gov.uk/corporate/legal/repro_licence.html) before using the data. This only needs to be completed once for each user. WARNING Some applications are unable to properly handle signed byte values. If values are encountered > 127, please subtract 256 from this reported value. GHRSST statement (2002-present): GHRSST protocol describes data use as free and open. Coral Reef Watch program statement: The data produced by Coral Reef Watch are available for use without restriction, but Coral Reef Watch relies on the ethics and integrity of the user to ensure that the source of the data and products is appropriately cited and credited. When using these data and products, credit and courtesy should be given to NOAA Coral Reef Watch. Please include the appropriate DOI associated with this dataset in the citation. For more information, visit the NOAA Coral Reef Watch website: https://coralreefwatch.noaa.gov. Recommendations for citing and providing credit are provided at https://coralreefwatch.noaa.gov/satellite/docs/recommendations_crw_citation.php. Users are referred to the footer section of Coral Reef Watch's website (https://coralreefwatch.noaa.gov/index.php) for disclaimers, policies, notices pertaining to the use of the data.
Donlon, et al., 2011. The Operational Sea Surface Temperature and Sea Ice analysis (OSTIA). Maturi, et al., 2017. A new high-resolution sea surface temperature analysis. https://coralreefwatch.noaa.gov/satellite/coraltemp.php
source :
OSTIA Sea Surface Temperature Reanalysis (night-only), NOAA Geo-Polar Blended Night-only Sea Surface Temperature Reanalysis, NOAA Geo-Polar Blended Night-only Sea Surface Temperature (near real-time)
sourceUrl :
(local files)
Southernmost_Northing :
-89.975
standard_name_vocabulary :
CF Standard Name Table v27
summary :
NOAA Coral Reef Watch Daily Global 5km Satellite Sea Surface Temperature (CoralTemp). CoralTemp is derived from three different but related 5km daily gap-free SST data sets and provides an internally consistent SST product that stretches from 1985 to present: Operational Sea Surface Temperature and Sea Ice Analysis (OSTIA) Sea Surface Temperature Reanalysis (1985-2002), Geo-Polar Blended Night-only Sea Surface Temperature Reanalysis (2002-2016), Geo-Polar Blended Night-only Sea Surface Temperature Near Real-Time (2017 to present).
The code below does the following: * Trims the data to include only SST data
* Selects the date. To avoid the need to match the exact date found in the dataset, include method='nearest'. * Slices within the latitude and longitude ranges
This may take a few seconds. So far you have only set the parameters for download but not requested that the data be downloaded. However, downloading will be necessary to plot the data, so xarray will download it.
Use the “where” function of xarray to flag all pixels in the habitat range by replacing their values with a value that is much smaller than the data range minimum.
ds_masked = xr.where((ds_subset > hab_temp_min) & (ds_subset < hab_temp_max), -999, # Set flag value ds_subset )
Map the masked data
Make some adjustments to the color map:
* Set the palette to be the reverse of the gist_rainbow
* Set missing values (like land..) to gray
* Set the flag value color
# Create the color palettecmap = mpl.cm.get_cmap("gist_rainbow_r").copy()# Set the color of the missing or masked data cmap.set_bad(color='gray') # missing values color (like land..)# Set the color of flag value (-999)cmap.set_under(color='firebrick') # flag value color# Plot the datads_masked.plot.pcolormesh(cmap=cmap, vmin=5, vmax=30, aspect=2, size=4 )# Add plot annotationplt.title('TurtleWatch band - '+ date_for_sat_data)plt.ylabel('Latitude')plt.xlabel('Longitude')