Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Simon's solution to plotting maps from xarray
- '''
- import cartopy
- def cyclicContourf(ax, dataFrame, *args, **kwargs):
- """
- make a filled contour by adding a cyclic value for longitude.
- :param dataFrame: data frame
- :param args: passsed straight through to contourf
- :param kwargs: passed straight through to contourf
- :return: the result..
- """
- data, lon = cartopy.util.add_cyclic_point(dataFrame.values, dataFrame.longitude.values)
- cm = ax.contourf(lon,dataFrame.latitude,data,*args,**kwargs)
- return cm
- def cyclicContour(ax, dataFrame, *args, **kwargs):
- """
- make a contour by adding a cyclic value for longitude.
- :param dataFrame: data frame
- :param args: passsed straight through to contour
- :param kwargs: passed straight through to contour
- :return: the result..
- """
- try:
- dataFrame.load()
- except AttributeError:
- pass
- data, lon = cartopy.util.add_cyclic_point(dataFrame.values, dataFrame.longitude.values)
- cm = ax.contour(lon,dataFrame.latitude,data,*args,**kwargs)
- return cm
Add Comment
Please, Sign In to add comment