Skip to main content

No project description provided

Project description


Logo

GERG Plotting

Data plotting package for GERG
Explore the docs »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact
  7. Acknowledgments

About The Project

This project was created to streamline and standardize the process of generating plots at GERG.

Built With

Python

Getting Started

There are two ways to get started

  1. Create a fresh virtual environment using your favorite method and install the package
  2. Use an already established virtual environment and install the package

Dependencies

I have provided a list of the dependencies and their versions below.

List of dependencies:

  • python = 3.12
  • numpy = 2.0.0
  • pandas = 2.2.2
  • matplotlib = 3.9.1
  • xarray = 2024.6.0
  • attrs = 23.2.0
  • netcdf4 = 1.7.1.post1
  • cmocean = 4.0.3
  • scipy = 1.14.0
  • mayavi = 4.8.2

Installation

  1. Activate your virtual environment
  2. Use pip to install pip install gerg_plotting

Usage

Plot data at GERG using Python.

Example: Create a histogram for U current vectors

import xarray as xr
from gerg_plotting import Buoy, Histogram

# Open in the dataset using xarray
ds = xr.open_dataset('buoy.nc')
# Convert the dataset variable to a flat pandas dataframe
df = ds['u'].to_dataframe().reset_index()

# Initialize the buoy instrument data container
buoy = Buoy(u_current=df['u'])

# Initialize the histogram plotter
hist = Histogram(instrument=buoy)
# Plot the 1-d histograms for u and v currents
hist.plot(var='u_current',bins=100)
hist.ax.set_title('Current Vector U')

ocean current vector histograms

Example: Create A GIf of the Map of CTD Missions

import pandas as pd
import matplotlib.pyplot as plt
from gerg_plotting.SurfacePlot import SurfacePlot
from gerg_plotting.SpatialInstruments import Bounds,CTD
from gerg_plotting.Animator import Animator

def ctd_map(cruise,df:pd.DataFrame,bounds:Bounds):
    # Select the data you wish to plot for each frame
    df_cruise = df.loc[df['Cruise']==cruise]
    # Initalize the instrument data container
    ctd = CTD(lat=df_cruise['Latitude'],
              lon=df_cruise['Longitude'],
              depth=df_cruise['CTD BinDepth (m)'],
              time=df_cruise['Date_Time'],
              temperature=df_cruise['Temp (deg C)'],
              salinity=df_cruise['Salinity (PSU)'])
    
    # Initalize the surface plot class the bounds parameter is optional
    surfaces = SurfacePlot(instrument=ctd,bounds=bounds)
    # Create a map of the sample sites
    surfaces.map()
    surfaces.ax.set_title(f'Cruise {cruise}')
    # Optional, if you would like to show the figures as they are created
    plt.show()
    # Must return the surface plot class figure attribute
    return surfaces.fig

# Read in the data
df = pd.read_csv('../test_data/ctd.csv',parse_dates=['Date_Time'])
# Create the interable to loop over during the gif creation
# In this case we are showing each cruise as individual frames
cruises = list(set(df['Cruise']))  # Get the unique cruise values and return them as a list

# Optional, but a good idea so that you can specify the viewing location
bounds = Bounds(lat_min=27,
                lat_max=31,
                lon_max=-88,
                lon_min=-94,
                depth_bottom=150,
                depth_top=None)

# Create the animation gif by generating frames from the cruises iterable and save it to the gif_filename
Animator().animate(plotting_function=ctd_map,interable=cruises,fps=1,iteration_param='cruise',gif_filename='ctd_map.gif',df=df,bounds=bounds)

gif of ctd missions

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Alec Krueger - alecmkrueger@tamu.edu

Project Link: https://github.com/alecmkrueger/gerg_plotting

Acknowledgments

  • Alec Krueger, Texas A&M University, Geochemical and Environmental Research Group, alecmkrueger@tamu.edu

(back to top)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gerg_plotting-0.0.15.tar.gz (57.3 MB view details)

Uploaded Source

Built Distribution

gerg_plotting-0.0.15-py3-none-any.whl (57.3 MB view details)

Uploaded Python 3

File details

Details for the file gerg_plotting-0.0.15.tar.gz.

File metadata

  • Download URL: gerg_plotting-0.0.15.tar.gz
  • Upload date:
  • Size: 57.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Windows/11

File hashes

Hashes for gerg_plotting-0.0.15.tar.gz
Algorithm Hash digest
SHA256 68bc6cd6b96bb4efda5d224a16ff1a6a5e448ed5738493e20f3e0dc4d487839d
MD5 a424b18fbeffac34681e4fd46f00f0ea
BLAKE2b-256 5e9a07c9a300bd69dcc59ae5b375a205ec0314eed7420cba2595feb40cf55c1f

See more details on using hashes here.

File details

Details for the file gerg_plotting-0.0.15-py3-none-any.whl.

File metadata

  • Download URL: gerg_plotting-0.0.15-py3-none-any.whl
  • Upload date:
  • Size: 57.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Windows/11

File hashes

Hashes for gerg_plotting-0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 67755ee7dbaa3867be5c7d33c1899aab40ab7018e43bf46703a1e69d8743f920
MD5 072053c796e76b0b6db01f36d8832be6
BLAKE2b-256 d5a594afded9d892d8e489838b448d599a982c99184f9c1ceba5221518d49fce

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page