Partial compilation of NetCDF4 library to WebAssembly with TypeScript bindings
npm install @earthyscience/netcdf4-wasm








Partial WebAssembly port of the NetCDF4 C library with TypeScript bindings for browser and Node.js
netcdf4-wasm brings the power of NetCDF4 to web browsers and Node.js through WebAssembly. Read and write NetCDF files directly in JavaScript with a familiar, Python-inspired API.
Features:
- 🌐 Works in browsers and Node.js
- 📦 Partial NetCDF4 file format support
- 🐍 API modeled after netcdf4-python
- 🚀 High-performance WASM compilation
- 📝 Complete TypeScript type definitions
> [!TIP]
> Want to do more? Plot, visualize, and explore your data at browzarr.io
``bash`
npm install @earthyscience/netcdf4-wasm
typescript
import { NetCDF4 } from '@earthyscience/netcdf4-wasm';// Open existing file
const ds = await NetCDF4.fromBlobLazy(file);
// Access dimensions
// TODO: Add example
// Read variables
// TODO: Add example
// Close when done
ds.close();
`$3
`typescript
// Access groups
// TODO: Add example
`$3
`typescript
import { NetCDF4 } from '@earthyscience/netcdf4-wasm';// Create a new NetCDF file
// TODO: Add example
`API Reference
The API closely follows netcdf4-python conventions, making it intuitive for scientists familiar with Python.
Core Classes:
-
NetCDF4 - Main file interface
-
Advanced Usage
Memory Configuration
If you encounter memory-related errors with large files, you can increase the initial memory allocation:
`typescript
// TODO: Add example once API is stable
``See our Contributing Guide for detailed build instructions.
We welcome contributions! Please see our Contributing Guide for details.
- NetCDF4 C Library Documentation
- netcdf4-python Documentation
- GitHub Issues
- GitHub Discussions
This project builds upon the initial work from oceanum-io/netcdf4-wasm. We're grateful for their foundational efforts in bringing NetCDF4 to WebAssembly and are continuing their work with additional features and improvements.