-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update API documentation and switch to @properties
for some Descriptor
attributes.
#22
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@andrewdnolan, these changes look great to me! I have some picky suggestions about single-line docstrings below.
I built the docs locally and looked through them. Everything looked as expected -- very clean!
d2201ba
to
1c951b5
Compare
for certain Descriptor attributes, that need additional logical in the setter methods.
Correct the formatting for single line doc strings. Co-authored-by: Xylar Asay-Davis <[email protected]>
5723b57
to
7205e75
Compare
TestingHere's a demonstration of the reprojection capabilities enable by the import cartopy.crs as ccrs
import mosaic
import matplotlib.pyplot as plt
import xarray as xr
def make_figure(ds, descriptor):
fig, ax = plt.subplots(
figsize=(9,7), constrained_layout=True, subplot_kw=dict(projection=descriptor.projection)
)
collection = mosaic.polypcolor(ax, descriptor, ds.indexToCellID, antialiaseds=True)
ax.coastlines()
fig.colorbar(collection, fraction=0.1, shrink=0.5, label="Cell Index");
return fig, ax
ds = mosaic.datasets.open_dataset("QU.240km")
projection_one = ccrs.InterruptedGoodeHomolosine()
projection_two = ccrs.LambertConformal()
transform = ccrs.PlateCarree()
descriptor = mosaic.Descriptor(ds, projection_one, transform)
# first figure with original projection
fig_one, ax_one = make_figure(ds, descriptor)
# switch the projection of the descriptor
descriptor.projection = projection_two
# second figure with new projection
fig_two, ax_two = make_figure(ds, descriptor)
plt.show() Figure One:Figure Two: |
This PR:
Improves the documentation, switch to numpy style docstrings. The primary improvements are made for the
Descriptor
class, which has improved formatting and more detailed information (for both the class itself and it's attributes).I've switched the
projection
andlatlon
attributes to be properties. I did this in order to move some logic outside of the method construct to abstract things a little. Most importantly the coordinate arrays (from the minimal dataset) transformation has been moved to theDescriptor.projection
setter method so that reprojection to a new map projection after Descriptor initialization is now possible, although not really advised. These abstraction should also help set the groundwork for planar-periodic mesh support.