Skip to content

NASA-SASSIE/data-vis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to SASSIE Data Visualization Github!

DOI

Thank you for you interest in the SASSIE campaign data!

SASSIE is a NASA funded project that aims to better understand the role of salinity stratification in the marginal ice zone. In the fall of 2022, SASSIE conducted a field campaign off the Alaskan coast in the Beaufort Sea. This campaign included shipboard measurements as well as 6 remotely piloted/drifing platforms and an ariel campaign. To learn more, please visit https://salinity.oceansciences.org/sassie.html

Use these notebooks to explore SASSIE data!

In this repository, you will find Jupyter Notebooks that show ways to download and visualize data collected durring the SASSIE campaign.

The aim of this notebook is to assist in exploratory data analysis by downloading the SASSIE Data from NASA's PODAAC, opening the datasets and displaying their associated metadata, and creating a few visualizations that can be saved to the user's local disc. This notebook was created by Elizabeth Westbrook. For questions and trouble shooting, please email elizabeth.e.westbrook@gmail.com.

The notebooks are accessible through a Jupyter binder. Please visit https://mybinder.org/v2/gh/lizwestbro/SASSIE_Data/HEAD

Binder

How to Use

There are a total of 10 notebooks that are currently a part of this data visualization set. Each one covers the download and basic visualization of one dataset that was collected durring the SASSIE campaign. There are four sections in each notebook. The sections must all be run in order from top to bottom for the notebook to work properly

  1. Credential Entry
  2. Data Download and Metadata Veiwing
  3. Supporting Code
  4. Figure Making Code

Each of these sections is described in more detail below.

Section 1 - Credential Entry

WARNING: DO NOT ENTER SENSITIVE CREDENTAILS INTO JUPYTER BINDER! While binder takes precautions to make the notebooks secure (see usage guidelines here) They are still vulnerable to security breahes. Make sure that the cerdentials you use in these notebooks are not used for any sensitve accounts elsewhere

In this section, you must replace 'username' and 'password' (shown below in red) with your credentials for NASA's Earthdata to gain access to published SASSIE data, as well as AMSR Ice data if you choose to use it in any figures (if you do not have an earthdata account, you can create one here for free).

Screenshot 2023-08-07 at 9 48 22 AM

Section 2 - Data Download and Metadata Viewing

Within this section, there is code to download the dataset from NASA's PODAAC, as well as look into the file and view the variables inside of it using xarray. First, the packages used throughout the notebook are imported.

Screenshot 2023-08-07 at 9 53 04 AM

Downloading the Data

Next, a directory is created within the binder to store the downloaded data using the code below. You can alter this path to change where the data is stored within the notebook.

Screenshot 2023-08-07 at 10 02 37 AM

By default, the notebook will create a new folder called 'Data' and then a sub folder for each dataset.

For security reasons, you are not able to use the code to download the datasets to your local directory if you are accessing the notebooks using binder. Instead, you must go to the folder within the binder where the data is stored, right click on the file you wish to download, and click 'Download'.

Screenshot 2023-08-07 at 2 22 15 PM

If you are looking for a simpler way to download SASSIE data to your local disk, without any visualization, you can access them on PODAAC here or use the SASSIE data download tool here

The next block of code in the data download section sends your credentials and a request for the files of interest to NASA's PODAAC. This block of code should not be changed:

Screenshot 2023-08-07 at 12 40 58 PM

If you have already run this block of code and the file is already in the specified directory above, it will not re-download the data.

Viewing the Metadata

After the dataset has been downloaded, the metadata viewing subsection will use the xarray package to open up this clickable html table showing the names of the variables in the file. You can expand each section for more details or to preview the data by clicking the arrows on the left hand side of the table and the symbols on the right hand side:

Screenshot 2023-08-07 at 12 44 20 PM

Section 3 - Supporting Code

The purpose of this section is to act as a precursor to running the figure making code in the next section which makes exploratory data analysis figures. The contents of this section will depend on what functions are appropriate for the visualization of each data set, so not all of the code described below is included in every notebook. The first block in this section will define a directory within the binder where the figures will be stored:

Screenshot 2023-08-07 at 2 19 34 PM

The default path here will create a new folder called 'Figures' with a subfolder for each dataset. Like the data directory created in the previous section, this can be changed depending on the user's preference. Figures can also be manually downloaded onto the local machine the same way datasets can.

Some of the map figures optionally use AMSR Ice Concentration data and NOAA Bathymetry Data. The following block of code creates a directory within the binder to store AMSR ice data and also remotely accesses the NOAA bathymetry data

Screenshot 2023-08-07 at 3 04 47 PM

The SASSIE cruise was broken up into five distinct 'plays', and it may be useful to look at shipboad data on a play-by-play basis. Theerefore, for the shipboard data sets, the supporting code section contains a block that defines the start and end date of each play so that they can be easily referenced later

Screenshot 2023-08-08 at 11 42 51 AM

For non-shipboard datasets, there is an option to additionally plot the shiptrack on the maps that are produced as a reference. For this, the shipboard TSG file must be downloaded. The supporting code section contains a block of code that does this.

Screenshot 2023-08-08 at 11 54 25 AM

Supporting Code Functions

This section also defines some functions that will be used in the figure making code. These functions simplify the figure making code. Some of the functions can be customized to change the features of the figures that are made. Below, each of these functions is explained:

def_variable_attributes(var)

Screenshot 2023-08-07 at 2 30 22 PM

The purpose of this function is to define a color palette and a label for each variable found in the file. Because different platforms collected different data, it will change from dataset to dataset. The color palettes are held as consistant as possible thoughout all the notebooks.

Inputs

var (string) - The name of the variable within the file that needs a label and a color palette

Outputs

colormap (string) - The name of the colormap that will be used to represent the variable on a plot

var_label (string) - The label that will be used to label the variable on an axis or a colorbar

map_study_area(latmin,latmax,lonmin,lonmax)

Screenshot 2023-08-07 at 2 56 46 PM

This function creates a map of the area in which the SASSIE campaign took place that includes markings for land and the rivers, as well as stars for the cities of Utqiagvik and Deadhorse when they are within the specified lat and lon range. The lat and lon range can be adjusted when the function is called to zoom in or out on the campaign area.

Inputs

latmin (float) - The minimum latitude limit of the map
latmax (float) - The maximum latitude limit of the map
lonmin (float) - The minimum longitude limit of the map
lonmax (float) - The maximum longitude limit of the map

Outputs

fig (global) - The handle for the map figure that will be used as a base for the map being made
ax (global) - The handle for the set of axes on which data will be plotted on the map

make_3d_grid(latmin,latmax,lonmin,lonmax,dmin,dmax)

Screenshot 2023-08-08 at 11 46 07 AM

This function is used as a substitute for a map when there is data taken at multiple levels below the surface. It will only appear in notebooks for datasets with a depth or sea pressure dimension. It creates a set of 3d axis and formats the figure so that it is ready to have data added to it.

Inputs

latmin (float) - The minimum latitude limit of the grid
latmax (float) - The maximum latitude limit of the grid
lonmin (float) - The minimum longitude limit of the grid
lonmax (float) - The maximum longitude limit of the grid
dmin or pmin (float) - The minimum depth or pressure limit of the grid
dmax or pmax (float) - The maximum depth or pressure limit of the grid

Outputs

fig (global) - The handle for the 3d grid figure that will be used as a base for the figure being made
ax (global) - The handle for the set of axes on which data will be plotted on the grid

add_ice_data(start_date,end_date)

Screenshot 2023-08-07 at 3 29 41 PM

First, this function will find and download the AMSR ice product that is closest in time to the start and end date specified. Then, it will plot the ice products on the current map figure. The product from the end date will be plotted using the 'Reds' color pallette, and then the product from the start date will be plotted using the 'Blues' color palette on top of it.

Some notebooks instead have a version of this function that only plots ice data from one specified date, such as the date of a deployment.

Inputs

start_date (datetime(yyy,mm,dd)) - The date at the beginning of the time range being plotted
end_date (datetime(yyyy,mm,dd)) - The date at the end of the time range being plotted

add_bathy_data(latmin,latmax,lonmin,lonmax)

Screenshot 2023-08-07 at 3 39 54 PM

This function will take the bathymetry data that was remotely accessed from NOAA and plot its contours on the map. The data is pre-indexed to include only every fifth data point within the specified lat and lon range to avoid slowing down the mapping code significantly. Contour levels are defined every 300 meters between 1000 and 6000 meters depth.

Inputs

latmin (float) - The minimum latitude limit of the map
latmax (float) - The maximum latitude limit of the map
lonmin (float) - The minimum longitude limit of the map
lonmax (float) - The maximum longitude limit of the map

add_ship_track()

Screenshot 2023-08-08 at 11 59 01 AM

When called, this function adds the track of the R/V Woldstad to a map.

Section 4 - Figure Making Code:

Like the Supporting Code section, the Figure Making Section will only include the code that is appropriate for the dataset at hand. The code for figure making is organized as functions which have various input arguments that allow for customization of the figures where appropriate. Further customization will require changes to the code itself. Under each function there is a block of code that shows examples of the function being used, which will produce some example plots when the code is run without any changes. These blocks can be adjusted by the user to fit their needs.

Figure Making Functions

Show the Time and Location of Data Collection

Each Notebook will have code to map out where in the campaign area the data were collected on a latitude - longitude axis, colored by date collected.

Screenshot 2023-08-08 at 7 57 14 AM

Inputs

play (int) or deployment (int) - Avalible for data that was taken at the surface level (like the TSG, MET, and Jet SSP). Limits the mapped data to only a certain subset of the data within a time range defined by a certain play or deployment (The date range of each play is defined in the supporting code when relevant. Set play=6 to show the whole campaign)

ice_data = False (boolean) - can optionally be set to True to add AMSR ice data at the beginning and end of the mapped time range.

bathy_data = True (boolean) - can optionally be set to False to exclude NOAA bathymetry data from the map

ship_track = True (boolean) - exists for datasets from remote and drifting platforms. By default, this maps the track of the ship as a solid black line for comparison with the track of the independant platform. Can optionally be set to False to exclude the shiptrack line from the map.

Outputs

Below are some examples of figures produced using this mapping code.

SASSIE_SHIPTRACK_TSG_entire_campaign cCTD_deployment_map ALTO_ALAMO_paths

Mapping Datasets Colored by a Variable in the File

This function is very similar to the function described above, except that it colors the track of the data set by some ocean or atmospheric variable taken at the water's surface. If there are not surface level variable in a data set, such as in the uCTD and cCTD this function is not included.

Screenshot 2023-08-08 at 9 43 02 AM

For the datasets that include wind speed and direction data (jetSSP and Shipboard Meteorology), there is a special variation of this function that maps the data as a quiver plot with arrows with the direction and magnitude representing the wind. An example is shown below.

Inputs

var (string) - The name of the variable, as it appears in the netCDF file, that is to be coloring the track on the figure.

var_min (float) - The lower limit of the colorbar that will measure the variable described by var.

var_max (float) - The upper limit of the colorbar that will measure the variable described by var.

play (int) or deployment (int) - Limits the mapped data to only a certain subset of the data within a time range defined by a certain play or deployment (The date range of each play is defined in the supporting code when relevant. Set play=6 to show the whole campaign)

ice_data = False (boolean) - can optionally be set to True to add AMSR ice data at the beginning and end of the mapped time range.

bathy_data = True (boolean) - can optionally be set to False to exclude NOAA bathymetry data from the map

ship_track = True (boolean) - exists for datasets from remote and drifting platforms. By default, this maps the track of the ship as a solid black line for comparison with the track of the independant platform. Can optionally be set to False to exclude the shiptrack line from the map.

Outputs

Below are some examples of figures produced using this mapping code.

SASSIE_jet_SSP_Deployment5_temperature_surface SASSIE_SHIPBOARD_MET_entire_campaign SASSIE_SHIPBOARD_TSG_play_4

Make a 3d Representation of Trajectory Profile Data

These functions will vary slightly between all the notebooks that include them, which are the notebooks for datasets that have vertical profile data. The example below is for the ALTO/ALAMO floats.

Screenshot 2023-08-08 at 12 06 43 PM

Inputs

float_number/play/buoy/deployment (int) - Defines which data out of the whole set needs to be plotted (ex: which float's profiles to plot or data from which play of a shipboard data set like the uCTD or cCTD)

var (string) - The name of the variable, as it appears in the netCDF file, that is to be coloring the profiles on the figure.

Outputs

Below are some examples of 3d grid plots that can be made using these functions

uCTDsalinity202209190000_202209230000 SASSIE_jet_SSP_Deployment3_temperature ALTO_ALAMO_temperature_Float_9098

Make a 2D Representation of Trajectory Profile data

Rather than put the trajectory profile data on a 3D lat-lon-depth axis, there is another function included for the trajectory profile datasets that plots this data on a 2D time-depth axis.

Screenshot 2023-08-09 at 9 14 33 AM

Inputs

start_time (datetime.datetime) - The minimum time of the date range covered by the plot

end_time (datetime.datetime) - The maximum time of the date range covered by the plot

var(string) - The name of the variable, as it appears in the netCDF file, that the data points on the 2D plot should be colored by

CTD_unit (int) - In the case of the Under Ice Float data, this specifies which data from the multiple CTDs on the platform should be used.

Outputs

Screenshot 2023-08-09 at 9 18 27 AM

Plot Variables from the Dataset on a 2D Time Series Axis

This function will vary widely between datasets because the figure it produces is meant to provide a summary of the most important variables in the file. Some of the functions will produce 1 or 2 subplots while others produce more compliated figures with 3 or 4 subplots. The example below is a less complicated function for the TSG data timeseries.

Screenshot 2023-08-08 at 9 54 18 AM

Inputs

play (int) or deployment (int) - Limits the plotted data to only a certain subset of the data within a time range defined by a certain play or deployment (The date range of each play is defined in the supporting code when relevant. Set play=6 to show the whole campaign)

var1,var2,...etc (string) - Some of the timeseries function, like that of the SWIFT buoy dataset, allow the user to choose which variables they want plotted. These inputs are the string names of the variables as they appear in the netCDF file

Outputs

Below is a simple example (TSG) and a more complicated example (SWIFT buoys) of a figure produced using this code.

SASSIE_SHIPBOARD_TSG_entire_campaign SWIFTall_Playall_salinity_water_temperature_wind_speed

Plot Individual Profiles from a profile dataset

For the datasets that include vertical profiles, a function is includes that can plot individual profiles, either by the profile number(if it is included in the file) or by finding the closest profile to a particular date. Some notebooks have two versions of this function to create the figures in two different formats - one where temperature and salinity are on two seperate subplots and one where they share the same set of axis.

Screenshot 2023-08-09 at 8 30 20 AM Screenshot 2023-08-09 at 8 37 24 AM

Inputs

cast_number (int) or date (datetime.datetime) - the input argument that tells the function which profile to plot. If cast_numbers are not included in the data files, a date can be used which will find the closesst profile in time to that date.

float_number (int) or other platform number - If there are multiple platforms int eh dataset (ex. multiple alto alamo floats which are deployed int he same time range) it is necessary to specify which of these platforms the data should come from with this argument.

Outputs

Below is an example of the ALTO_ALAMO profiles in a same axis format and an example of the uCTD profiles in the two subplot format.

float9101_profile_20220921025300 uCTD_profile1000_20220921143317

T-S Plots of CTD data

The uCTD and cCTD notebooks each have a function that scatters data from a given time range on a temperature - salinity axis and colors the points by a coordinate variable (time, depth, latitude, longitude) of the user's choice.

Screenshot 2023-08-09 at 8 47 42 AM

Inputs

start_time (datetime.datetime) - The beginning of the time range to be covered by the scatter plot.

end_time (datetime.datetime) - The end of the time range to be covered by the scatter plot.

var (string) - The name of the coordinate variable, as it appears in the netCDF file, that the scatter points will be colored based on.

Outputs

Screenshot 2023-08-09 at 8 51 29 AM

Histogram of Delta 18O Bottle Data

The bottle data notebook has an option to create a histogram of the temperatures and delta 18O ratios collected throguhout the campaign

Screenshot 2023-08-09 at 8 56 37 AM

Inputs

var (string) - Should either be 'temperature' or 'd18O' depending on which variable from the netCDF file the user is making a histogram of.

Outputs

Screenshot 2023-08-09 at 8 58 37 AM

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •