Comments (5)
- IMHO, use
dimensions
. It's much clearer ;) - keep
create_dimensions
. Best not to second-guess someone's use case, maybe someone wants to create a dimension without immediately adding a variable. Or someone wants to create a dimension that's re-used by several variables.
And an idea: Make it possible to dump the structure of file as a descriptive dict. Makes exploring an existing file easier. Something like:
{
'distance': {
'dimension': 'x',
'units': 'm',
'data': <array float[100]>
},
'time' {
'dimension': 't',
'units': 'm2',
'data':<array datetime[100]>
},
'readings' {
'dimension': ('x', 't'),
'units': 'W',
'data': <array float[100, 100]>
}
}
Building on that, it might be nice to make it possible to create a file based on a spec described in a dict. This allows you to use a declarative style rather than an imperative one - rather than a series of commands to create your files, you describe what data you want and the build a file from the spec.
x_data = ...
times = ...
readings = ...
spec = {
'distance': {
'dimension': 'x',
'units': 'm',
'data': x_data
},
'time' {
'dimension': 't',
'units': 'm2',
'data': times
},
'readings' {
'dimension': ('x', 't'),
'units': 'W',
'data': readings
}
}
hfile = h5netcdf.create_file(spec)
You could even enable a full round-trip, something like:
spec = h5netcdf.describe(file)
# Optionally manipulate the spec here, e.g. change the data
new_file = h5netcdf.create_file(spec)
Though less sure about this, might need to think about lazy-loading data and things like that...
from h5netcdf.
@mangecoeur To clarify, I was considering dropping create_dimension
in favor of using dimensions
with the dictionary-like interface for assignment.
from h5netcdf.
@shoyer ah right, yeah that makes sense
from h5netcdf.
I like the idea of declarative dataset specifications, but I'm not sure it's a good fit for this package. It could exist easily as an independent project that uses h5netcdf
(and/or netCDF4
/scipy.io.netcdf
) as a library. In fact, I would encourage you to go out and build that project yourself :).
from h5netcdf.
@shoyer Can this be closed? We might think to compile everything into some documentation (to not overcrowd the README).
from h5netcdf.
Related Issues (20)
- Can numpy objects be supported? HOT 5
- h5netcdf writes invalid netcdf to existing netcdf files HOT 6
- Corrupted headers when serialising using dask.distributed client HOT 9
- Test failures with NetCDF 4.9.0 HOT 6
- Remove h5py2 related code and CI builds HOT 3
- FAILED h5netcdf/tests/test_h5netcdf.py::test_group_names HOT 6
- AttributeError for '_phony_dim_count' when trying to convert a file made with h5py HOT 12
- Tests test_more_than_7_attr_creation_track_order and test_bool_slicing_length_one_dim fail in the test suite HOT 18
- very slow partial reading when saved with index shift HOT 10
- h5py minimum version update? HOT 5
- Improving performance for h5netcdf HOT 7
- Documentation request: Alternative way to obtain h5netcdf HOT 1
- Segmentation fault after upgrading to h5netcdf==1.1.0 HOT 14
- ValueError raised when attribute has type `h5py.Reference` HOT 5
- support for HDF5 dimension scales with null dataspace HOT 2
- Modifying attributes safely is not possible with all datasets. HOT 10
- Better Error for illegal variable names HOT 3
- md5 checksum mismatch for identical files/data HOT 7
- Question: does `h5netcdf` bring in the entire data from a netCDF file on a remote disk (like S3)? HOT 5
- Provide an example with time dimension readable by paraview HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from h5netcdf.