GithubHelp home page GithubHelp logo

blaylockbk / carpenter_workshop Goto Github PK

View Code? Open in Web Editor NEW
31.0 31.0 7.0 14.16 MB

Brian's python workshop, where he keeps his tools, paint, and anything else useful.

Home Page: https://blaylockbk.github.io/Carpenter_Workshop/

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
cartopy matplotlib python tools

carpenter_workshop's People

Contributors

blaylockbk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

carpenter_workshop's Issues

Ocean and Land color doesn't plot for NorthPolarStereo

ax = EasyMap(figsize=10, dark=True, crs=ccrs.NorthPolarStereo()).OCEAN().LAND().ax

image

But for some reason the south pole does work...

ax = EasyMap(figsize=10, dark=True, crs=ccrs.SouthPolarStereo()).OCEAN().LAND().ax

image

TypeError when running code on Google Colab

I'm running code from HRRR Data. It works perfectly in a local Jupyter notebook, but runs into an error on Google Colab (with condacolab installed). Am I missing a library somewhere?

My code :


!pip install -q condacolab
import condacolab
condacolab.install()

!mamba install -q -c conda-forge cartopy metpy herbie-data
!pip install git+https://github.com/blaylockbk/Carpenter_Workshop.git

from herbie import Herbie
from toolbox import EasyMap, pc
from paint.standard2 import cm_tmp

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
from metpy import units

H = Herbie(
    "2022-12-24",
    model="hrrr",
    product="sfc",
    fxx=0,
)

ds = H.xarray("TMP:2 m above")

ax = EasyMap("50m", crs=ds.herbie.crs, figsize=[20, 12]).STATES().ax
ax.set_extent([-125, -105, 35, 50])
p = ax.pcolormesh(
    ds.longitude,
    ds.latitude,
    ds.t2m.metpy.convert_units('degF'),
    transform=pc,
    **cm_tmp(units="F").cmap_kwargs,
)
plt.colorbar(
    p,
    ax=ax,
    orientation="horizontal",
    pad=0.01,
    shrink=0.8,
    **cm_tmp(units="F").cbar_kwargs,
)

ax.set_title(
    f"{ds.model.upper()}: {H.product_description}\nValid: {ds.valid_time.dt.strftime('%H:%M UTC %d %b %Y').item()}",
    loc="left",
)
ax.set_title(ds.t2m.GRIB_name, loc="right")

The resulting error on Colab:

TypeError                                 Traceback (most recent call last)
<ipython-input-9-5245a609d364> in <module>
     24     ds.t2m.metpy.convert_units('degF'),
     25     transform=pc,
---> 26     **cm_tmp(units="F").cmap_kwargs,
     27 )
     28 plt.colorbar(

1 frames
/usr/local/lib/python3.8/site-packages/paint/standard2.py in _segmented_cmap(name, colors, bounds, extend)
    101 def _segmented_cmap(name, colors, bounds, extend="neither"):
    102     cmap = mcolors.LinearSegmentedColormap.from_list(name, colors, N=len(bounds) + 1)
--> 103     norm = mcolors.BoundaryNorm(bounds, cmap.N, extend=extend)
    104     return cmap, norm
    105 

TypeError: __init__() got an unexpected keyword argument 'extend'

Plot terrain and bathymetry

Publish on PyPI

This should probably be published on PyPI since it is an optional dependency of Herbie and goes2go.

common_features: add terrain background map plotted from GFS

I would like to add this as a map background option for the cartopy_tools.common_features class...

image

Could be terrain field from GFS, HRRR, or another model

This would require Herbie being installed, and getting the data.

from herbie import Herbie

model = 'hrrr'

def TERRAIN2(self, date, model):
    H = Herbie(date, model)
    ds = H.terrain()

    # color the map background water
    self.ax.set_facecolor(water_color)

    # plot the terrain
    ax.pcolormesh(
        ds.longitude,
        ds.latitude,
        ds.orog,
        transform=pc,
        **cm_terrain(water=False, land_top=5500).cmap_kwargs
    )

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.