Skip to main content

Oceanic and Atmospheric Functions

Project description

OAFuncs

Oceanic and Atmospheric Functions for Python.

OAFuncs provides utilities for NetCDF files, geoscience arrays, plotting, geographic masks, downloads, file operations, model data, and small workflow tools.

Installation

pip install oafuncs

Optional dependency groups:

data, interp, nc, draw, geo, down, office, parallel, sign, science, all, full

Package Structure

oafuncs
|-- oa_nc.py          NetCDF utilities
|-- oa_data.py        data interpolation helpers
|-- oa_geo.py         geographic and land/ocean mask helpers
|-- oa_draw.py        plotting helpers
|-- oa_cmap.py        colormap helpers
|-- oa_file.py        file operation helpers
|-- oa_date.py        date and timing helpers
|-- oa_down/          download helpers
|-- oa_model/         ROMS and WRF helpers
|-- oa_linux.py       Linux, HPC, and Slurm helpers
|-- oa_office.py      Office document helpers
|-- oa_sign/          website sign-in helpers
`-- oa_tool.py        command, progress bar, email, and parallel helpers

Public API

oa_nc

Function Purpose
save Write arrays, DataArrays, or Datasets to NetCDF.
merge Merge multiple NetCDF files.
modify Modify a variable value or variable attribute.
rename Rename a NetCDF variable or dimension.
check Check whether a NetCDF file is readable.
convert_longitude Convert longitude coordinates between [-180, 180] and [0, 360].
isel Select NetCDF data by dimension indices.
draw Plot variables from a NetCDF file or xarray object.
compress Apply NetCDF compression.
unscale Decode and remove scale_factor / add_offset storage encoding.

oa_data

Function Purpose
ensure_list Convert a value to a list.
interp_vertical Interpolate along the fixed z axis in [t, z, y, x] order.
interp_horizontal Interpolate horizontal fields over the fixed y, x axes.

oa_geo

Function Purpose
earth_distance Calculate great-circle distance between two lon/lat points.
mask_shapefile Mask a 2D field using a shapefile.
mask_land_ocean Keep land or ocean values using a land/ocean mask.
is_land Check whether a lon/lat point is on land.
is_ocean Check whether a lon/lat point is in the ocean.

oa_draw

Function Purpose
fig_minus Format minus signs in axis or colorbar tick labels.
gif Create a GIF from image files.
movie Create a video from image files.
setup_map Configure a Cartopy map.
ticks_symmetric Generate ticks symmetric around a center value.
font_CN Configure Chinese font support for Matplotlib.

oa_cmap

Function Purpose
show Preview a colormap.
to_color Convert a colormap to a list of colors.
create Create a custom colormap from colors or an RGB text file.
get Load a Matplotlib or custom colormap.
random_color Generate a random hex color.

oa_file

Function Purpose
script_dir Return the caller script directory, independent of current working directory. Also available as oafuncs.script_dir().
find Find files by pattern.
link Create symbolic links with wildcard support.
copy Copy files or directories with wildcard support.
move Move files or directories with wildcard support.
rename Rename files by replacing text in filenames.
remove_empty Remove empty folders recursively.
remove Delete files or directories by pattern.
size Return file size in the requested unit.
replace Replace text content and save the result.

oa_date

Function / Class Purpose
month_days Return the number of days in a month.
hour_range Generate datetime strings at an hourly interval.
adjust_time Offset a base time by a time delta.
timeit Decorator class for timing function execution.

oa_down

Function Purpose
download Download HYCOM data for one time or a time range.
draw_time_range Draw the available HYCOM time range.
download5doi Download literature files from DOI lists.
downloader Send a download task to Internet Download Manager.
get_ua Return a random user-agent string.

oa_model

Function Purpose
interp Interpolate and remap ROMS data to target lon/lat/depth grids.
header_record Build a WRF little_r header record.
data_record Build a WRF little_r data record.
ending_record Build a WRF little_r ending record.
tail_record Build a WRF little_r tail record.

oa_linux

Function Purpose
patch_slurm Update selected #SBATCH directives in a Slurm script.
submit Submit a Slurm job with queue-aware retry logic.
job_state Query Slurm job state.
is_linux Check whether the current system is Linux.
get_jobid Find a Slurm job ID by path or job name.

oa_office

Function Purpose
extract_pptx_notes Extract PowerPoint notes to a Word document.

oa_sign

Function Purpose
sign_in_love_ocean Sign in to 52ocean.
sign_in_meteorological_home Sign in to Meteorological Home.
sign_in_scientific_research Sign in to AbleSci.

oa_tool

Function / Class Purpose
run_command Run an external command safely without using a shell.
Pex Parallel executor wrapper with progress and timing. PEx remains as a deprecated compatibility alias.
email Send an email.
pbar Create a colored progress bar.

Links

License

MIT License. See LICENSE.txt.

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

oafuncs-0.0.99.48.tar.gz (175.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oafuncs-0.0.99.48-py3-none-any.whl (182.5 kB view details)

Uploaded Python 3

File details

Details for the file oafuncs-0.0.99.48.tar.gz.

File metadata

  • Download URL: oafuncs-0.0.99.48.tar.gz
  • Upload date:
  • Size: 175.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for oafuncs-0.0.99.48.tar.gz
Algorithm Hash digest
SHA256 6cbc5fd09454621f556c0bfae071b577c7ee4c0ed1b8d95b2a09110e794e6f98
MD5 d70957f7489904d1a8da91910492daf4
BLAKE2b-256 a1a3a00ab947612ae5c86656e9a582df229764ef4a308ed83fc4055f15cfa39c

See more details on using hashes here.

File details

Details for the file oafuncs-0.0.99.48-py3-none-any.whl.

File metadata

  • Download URL: oafuncs-0.0.99.48-py3-none-any.whl
  • Upload date:
  • Size: 182.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for oafuncs-0.0.99.48-py3-none-any.whl
Algorithm Hash digest
SHA256 3e4aa1ed49196913b318980b1c781459b2ff8ddd750c45f2fc06a19ff3d1ee01
MD5 13a7e33670d80d2530c21f0201317f1f
BLAKE2b-256 966c5f58490b59fe77a25fdc5f1df6abada221cdf495813e25880cdf08745787

See more details on using hashes here.

Supported by

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