yt-project / yt

Main yt repository
http://yt-project.org
Other
465 stars 276 forks source link

BUG: Fix geographic coords convert_to_cartesian with units #4893

Closed chrishavlin closed 5 months ago

chrishavlin commented 5 months ago

Close #4892

chrishavlin commented 5 months ago

just confirming, the code snippet from the issue now runs as expected

import numpy as np
dshp = (16,16,16)
data = {'density': np.random.random(dshp)}

bbox = np.array([[0, 1000], 
                [-150., -100.], 
                [-90., 90.]])
ds = yt.load_uniform_grid(data, dshp, geometry='geographic', 
                          bbox = bbox,
                          axis_order=('altitude', 'longitude', 'latitude'))

yt.SlicePlot(ds, 'altitude', 'density', window_size=(3,2))

chrishavlin commented 5 months ago

pre-commit.ci autofix

chrishavlin commented 5 months ago

I'd prefer if we used colatitude instead of theta internally,

good idea. would save me from adding comments to remind myself later that theta is colatitude :)

I'll make those changes.