Questions tagged [metpy]

MetPy is a collection of tools in Python for reading, visualizing and performing calculations with weather data.

MetPy is a Python library for reading, visualizing and performing calculations with weather data. It leverages heavily the xarray library for its data model, though it is designed to work on any data that you can get into a numpy array--sometimes needing unit information, which is provided through the Pint library.

Resources

211 questions
0
votes
0 answers

metpy.calc.advection TypeError: invalid indexer array

When I plan to calculate temperature advection from array dataset, an error came out: TypeError: invalid indexer array, does not have integer dtype: array(None, dtype=object) example: I read WRF output and the xarray dataarray…
linyenheng
  • 33
  • 3
0
votes
1 answer

Cause of ValueError while plotting Cross Section Analysis on Metpy

I get the example code from this website: https://unidata.github.io/MetPy/latest/examples/cross_section.html#sphx-glr-examples-cross-section-py I wonder why the example programs can't work on my computer with either xarray-0.15.0 or with…
cibaouc
  • 5
  • 2
0
votes
3 answers

Interpolating GFS winds from isobaric to height coordinates using Metpy

I have been tasked with making plots of winds at various levels of the atmosphere to support aviation. While I have been able to make some nice plots using GFS model data (see code below), I'm really having to make a rough approximation of height…
0
votes
1 answer

Cause of ValueError while plotting combine plot on Metpy

a ValueError come out when run the example code I get the example code from this website: https://unidata.github.io/MetPy/latest/examples/plots/Combined_plotting.html I wonder why the example programs (both the Combined_plotting.py and…
cibaouc
  • 5
  • 2
0
votes
1 answer

Neighborhoods in MetPy

Does MetPy have a built in tool to deal with neighborhood functions applied to a meteorological parameter grids, such as fractional coverage within some radius of influence? I had constructed something with GEMPAK several years ago but didn't know…
0
votes
1 answer

How to plot a circle with a varying radius in each quadrant?

I'd like to draw a shape similar to the following example (from the Naval Research Laboratory TC page). The shape is defined by 4 radii, one for each quadrant. I have multiple track centers in latitude and longitude coordinates of which I plot…
0
votes
1 answer

Cartopy is crashing google codelab

I am using Cartopy and Metpy to create new graphics. When using Google codelab when ever I try to set an extent with on my maps with: track_line_gdf = geopandas.read_file('/content/al112017-020_5day_lin.shp') cone_gdf =…
0
votes
1 answer

How to calculate vertical altitude profiles

I want to calculate the layer thickness from ECMWF data. What I have are the variables T (within one layer) and relhum (within one layer) and pressure (both at layer interfaces, and at layer midpoints). I have trouble understanding the pressure…
andreas-h
  • 10,679
  • 18
  • 60
  • 78
0
votes
1 answer

How do I get arrays of coordinate values for a variable from a netCDF gridded dataset using Siphon and MetPy?

I have requested a netCDF subset using Siphon and formed a query to retrieve a variable within a bounding box: from siphon.catalog import TDSCatalog cat =…
0
votes
0 answers

Calculating precipitable water

I am having issues on how to calculate precipitable water using some of metpy's commands. Here's what I have so far for my code: EDITED import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import scipy.ndimage as ndimage from…
0
votes
1 answer

Issue with average calculated station spacing for objective analysis procedure

I am running the Barnes objective analysis procedure on Oklahoma Mesonet data using interpolate_to_grid, which reads in the calculated station spacing output from interpolate_to_points. This is calculated using ave_spacing = cdist(points,…
0
votes
1 answer

Cause of TypeError while plotting wind barbs on Metpy SkewT

Metpy.plots.skewT.plot_barbs throws this error: TypeError: ufunc 'isfinite' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe'' when given 3 Numpy arrays:…
WeatherEd
  • 13
  • 4
0
votes
1 answer

How to understand the format of a netCDF file

I am trying to generate a graph of the spatial average (i.e. 2x2 degrees) wave height and wind speed of each sea for various seas for a period of 5 years with yearly or monthly time interval (i.e. North/South Atlantic, Pacific, Arabic sea, North…
george
  • 1
  • 1
0
votes
1 answer

How to fix overlapping Metpy/Cartopy images?

When I run this code import Scientific.IO.NetCDF as S import cartopy.crs as ccrs import cartopy.feature as cfeature import matplotlib.pyplot as plt import xarray as xr import metpy import numpy as N from metpy.plots import ContourPlot, ImagePlot,…
0
votes
1 answer

KeyError when attempting to plot METAR

When attempting to plot surface observations from the THREDDS data server, my script hangs or returns a KeyError. Below is the code: metarfile = TDSCatalog('http://thredds.ucar.edu/thredds/catalog/' …