Skip to main content

Library for plotting dataset from noaa site in basemap

Project description


PyPI - License

NOAAWC

Library for plotting the world data climate with the data NOMADS NOAA/NASA


Please, Fork-me.

Installation

$ pip install noaawc -U

Examples

plotting

wind temperature with focus point

from noaawc.plot import plot_global
from noawclg.main import get_noaa_data as gnd
import matplotlib.pyplot as plt

plt.style.use('dark_background')
cmap = 'inferno'

date_base = '26/01/2023'
dn = gnd(date=date_base)
indice = 5



pg = plot_global(dn=dn)
pg.path=f'{cmap}_juazeiro_wind_focus1.png'
pg.title=f'Temperatura dos Jatos de Ventos'
pg.key_noaa='tmpmwl'
pg.indice=indice

pg.loc_focus=(-9.43847,-40.5052)

pg.text_cb='°C'
pg.author='@gpftc | @reinanbr_'
pg.cmap = cmap



pg.render(show=True)

wind temperature with focus point and text focus

from noaawc.plot import plot_global
from noawclg.main import get_noaa_data as gnd
import matplotlib.pyplot as plt

plt.style.use('dark_background')
cmap = 'inferno'

date_base = '26/01/2023'
dn = gnd(date=date_base)
indice = 5



pg = plot_global(dn=dn)
pg.path=f'{cmap}_juazeiro_wind_focus2.png'
pg.title=f'Temperatura dos Jatos de Ventos'
pg.key_noaa='tmpmwl'
pg.indice=indice

pg.loc_focus=(-9.43847,-40.5052)
pg.annotate_data_focus('. Juazeiro: %(data)sºC')
pg.annotate_color_focus = 'white'

pg.text_cb='°C'
pg.author='@gpftc | @reinanbr_'
pg.cmap = cmap



pg.render(show=True)

wind temperature with focus point, text focus and zoom

from noaawc.plot import plot_global
from noawclg.main import get_noaa_data as gnd
import matplotlib.pyplot as plt

plt.style.use('dark_background')
cmap = 'inferno'

date_base = '26/01/2023'
dn = gnd(date=date_base)
indice = 5



pg = plot_global(dn=dn)
pg.path=f'{cmap}_juazeiro_wind_focus.png'
pg.title=f'Temperatura dos Jatos de Ventos'
pg.key_noaa='tmpmwl'
pg.indice=indice

pg.loc_focus=(-9.43847,-40.5052)
pg.annotate_data_focus('. Juazeiro: %(data)sºC')
pg.annotate_color_focus = 'white'
pg.zoom(1,-1,-1,1)

pg.text_cb='°C'
pg.author='@gpftc | @reinanbr_'
pg.cmap = cmap



pg.render(show=True)

Animation GIF

First time with the class noaawc.animate.Create_plot_gif:

>>>  from noaawc.animate import Create_plot_gif as cgp

init var's in the class

#.../noaawc/animate.py
#...
import matplotlib.pyplot as plt
from noawclg.main import get_noaa_data as gnd
#...



@dataclass
class Create_plot_gif:
    dn:gnd
    path_save:str='img.gif'
    size:int=70
    path_data:str='data/img_'
    title:str=''
    key_noaa:str='vgrdpbl'
    loc_focus:tuple=(-9.45,-40.5)
    point_init=False
    point_end:float=False
    text_cb:str='°C'
    lon_stop:float=False
    alpha:float=.9
    subtr_data:float=273
    speed_frame:float=1
    speed_degree_frame:float=1
    zoom:tuple = None
    author = '@gpfc_ | @reinanbr_'
    annotate_focus_txt:str = None
    annotate_loc_txt:str = None
    annotate_loc_pos:tuple = (40.776676,-73.971321)
    color_annote_loc:str = 'white'
    fps:float = 10
    cmap:plt.cm=plt.cm.jet
    resolution:str = 'c'


#...

Wind Jet's

spinning

from noaawc.animate import Create_plot_gif as Cpf # importing class to work gif plot
from noawclg.main import get_noaa_data as gnd # importing class to work data

dn = gnd(date='16/01/2023') # set the now date (best yesterday) in format d/m/Y

point_init=[-9.43,-89] #point init to spinning
point_jua = [-9.43,-40.50] # end point (my city)

gif = Cpf(dn=dn) # setting data noaa on the class to work gif

cmap = 'inferno' # cmap theme color plot

gif.path_save=f'tests_gifs/wind/{cmap}_test_spin_temp_wind.gif' #path to save gif

gif.key_noaa = 'tmpmwl' # key from data that we want 

gif.title='temperatura dos jatos de vento' # title plot gif

#setting the points
gif.point_init=point_init 
gif.point_end=point_jua

#longitude stop
gif.lon_stop=-39

# setting cmap
gif.cmap = cmap

gif.author = '@gpfc_ | @reinanbr_' #setting the title author plot

gif.text_cb = 'ºC' #title from colorbar
gif.subtr_data = 273 # substitution of data (273, because K - 273 = ºC)

gif.tracing() # working string's, map's, daw's, line's
gif.render() # rendering the frames of gif

in the .../tests_gifs/wind/CMRmap_test_spin_temp_wind.gif:


surface temperature

from noaawc.animate import Create_plot_gif as Cpf
from noawclg.main import get_noaa_data as gnd

dn = gnd(date='16/01/2023')

point_init=[-9.43,-89]
point_jua = [-9.43,-40.50]

gif = Cpf(dn=dn)
gif.path_save='https://raw.githubusercontent.com/reinanbr/noaawc/main/tests_gifs/surface_temp/CMRmap_test_spin_temp_surface.gif'
gif.key_noaa = 'tmpsfc'
gif.title='temperatura da superficie'
gif.point_init=point_init
gif.point_end=point_jua
gif.lon_stop=-39
gif.annotate_loc_txt = '. Nova York: %(data)sºC'
gif.color_annote_loc = 'white'
gif.cmap = 'CMRmap'

gif.annotate_loc_pos:tuple = (40.776676,-73.971321) # point for write a text
gif.annotate_loc_txt = '. Nova York: %(data)sºC' # text for write in the plot
gif.color_annote_loc = 'white' # color of text

gif.tracing()
gif.render()

zoom on a focus

from noaawc.animate import Create_plot_gif as Cpf
from noawclg.main import get_noaa_data as gnd

dn = gnd()

gif = Cpf(dn=dn)
gif.path_save='tests_gifs/test_zoom_focus_temp_surface.gif'
gif.key_noaa = 'tmpsfc'
gif.title='temperatura da superficie'
gif.loc_focus= point_jua
gif.zoom = (4,-4,-.5,6) # xl,xr,yu,yd for zoom
gif.annotate_focus_txt = '. Juazeiro: %(data)sºC' # write text on focus point
gif.annotate_loc_txt = '. Nova York: %(data)sºC'
gif.tracing()
gif.render()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

noaawc-0.2-py3-none-any.whl (10.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page