ITA-Solar / helita

A Python library for solar physics from the Institute of Theoretical Astrophysics, University of Oslo
BSD 3-Clause "New" or "Revised" License
9 stars 17 forks source link

Incorrect order of (nhydr,nt) in "make_hdf5_atmos" in "helita/sim/rh15d.py #6

Closed vsadykov closed 6 years ago

vsadykov commented 6 years ago

It seems that the order of dimensions is different in nH and nh_var variables: nH: (nhydr,nt,), nh_var: (nt,nhydr,). The error is raised while copying information from one array to another. Code line "nh_var[nt[0]:nt[1], :nhydr] = nH

One more issue arises with z_var and z variables. It seems that z has dimensions (nt,nx,ny,nz), while z_var is shortened to (nt,nz). Copying from one variable to another also generates error. Code line "z_var[nt[0]:nt[1]] = z"

tiagopereira commented 6 years ago

The first issue was due to wrong documentation. The shape of nH should have been (nt, nhydr, nx, ny, nz), and not (nhydr, nt, nx, ny, nz). I've updated the docstrings to make this more clear.

The second issue was indeed a bug -- it was assuming that z was always 2 dimensional, when in fact it can also be 3D or 4D, (nhydr, nt, nx, ny, nz). This has been fixed in 10f02be25f7189976595fe1cf822f5b9ba4cb566.

In the future, please use make_xarray_atmos instead of make_hdf5_atmos. For RH 1.5D this should make no difference, but make_xarray_atmos makes files that have better metadata and play better with the visualisation tools in rh15d_vis.py. make_hdf5_atmos will probably be deprecated in the future.