ncBuilder
Project description
ncBuilder
netCDF4 tool to help creating new files from scratch
version 0.0.3
- Modified function names to use snake_style pattern
- Comments added to the main functions
- Example updated to follow the new patterns
example
from ncBuilder import ncBuilder
import datetime as dt
import numpy as np
import pandas as pd
dtNow = dt.datetime.now()
times = pd.date_range('2021-01-01', periods=10).to_pydatetime()
lat = np.arange(-30., 10. + 0.05, 0.05)
lon = np.arange(-60., -30 + 0.05, 0.05)
temp = np.random.rand(times.size, lat.size, lon.size)
nc_file = ncBuilder.initialize_nc(dtNow, '/path/to/file', '_suffix.nc')
# nc_file = ncBuilder.initialize_nc('file_name_here', '/path/to/file', '_suffix.nc')
# creating dimensions
ncBuilder.create_nc(nc_file, lat, lon, time=times)
# creating a single variable
ncBuilder.create_nc_variable(nc_file,
'temp',
comp_lvl=6,
dims=('time',
'latitude',
'longitude'),
dtype=np.float64,
units='°C',
standard_name='temperature in °C')
# updating a variable
ncBuilder.update_nc(nc_file, 'temp', temp)
# updating partially a variable
ncBuilder.update_nc(nc_file, 'temp', temp[:, 5:, :-5], dims=(slice(None), slice(5, None), slice(None, -5), ))
# closing the nc_file
nc_file.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ncBuilder-0.0.4.tar.gz
(5.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ncBuilder-0.0.4.tar.gz.
File metadata
- Download URL: ncBuilder-0.0.4.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e6892c6f7694eabbfcb3a45cbaf67f221388b78165b72fc56a0947ebba1803bb
|
|
| MD5 |
447c4fbbcc692e3496074172362977b4
|
|
| BLAKE2b-256 |
0396166a599f2303ffa2c6bc8065b2cfaaaa68c7ec7b1d3b05c42c1f5383cdef
|
File details
Details for the file ncBuilder-0.0.4-py3-none-any.whl.
File metadata
- Download URL: ncBuilder-0.0.4-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a77bd28cf30d3f7dbb4f676d68c88375471d003c26177f77b142a8feff17f86
|
|
| MD5 |
6cd1d160f3b0603acf8514c50ebb8c4e
|
|
| BLAKE2b-256 |
d805e56da1e5460b833b711bbfae95cbfc263096c7a61fc99031c1ef7b031355
|