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
4
votes
1 answer

Unable to assign y and x coordinates to xarray.DataArray

After working through the MetPy Cross Section Example, I unsuccessfully tried to generalize that example to NCEP NAM-12km GRIB2 files. By comparing the DataArray for my file to the example file (a netCDF file), I find xarray.open_dataset() is not…
gdlewen
  • 73
  • 4
4
votes
2 answers

Errors when using metpy to calculate specific humidity

I would like to use metpy to calculate the near-surface (i.e. 2m) specific humidity using ERA5 hourly reanalysis data. I just installed metpy locally yesterday via pip, so I'm assuming that my code is up-to-date. My problem is that I keep running…
DanJonesOcean
  • 55
  • 1
  • 10
4
votes
1 answer

Interpolate Temperature Data On Urban Area Using Cartopy

I'm trying to interpolate temperature data observed on an urban area formed by 5 locations. I am using cartopy to interpolate and draw the map, however, when I run the script the temperature interpolation is not shown and I only get the layer of the…
user1345283
  • 645
  • 5
  • 11
  • 18
3
votes
2 answers

Fill U.S. counties by value using Python & Cartopy?

I'd like to know how to fill in a map of U.S. counties by value (i.e., a chloropleth map), using Python 3 and Cartopy, and I haven't yet found anything online to guide me in that. That filled value could be, for instance, highest recorded tornado…
Jared Lee
  • 53
  • 4
3
votes
3 answers

Interpolation gridded data to geographical point location

I am a big fan of MetPy and had a look at their interpolation functions (https://unidata.github.io/MetPy/latest/api/generated/metpy.interpolate.html) but could not find what I was looking for. I am looking for a function to interpolate a gridded 2D…
Sebastian
  • 33
  • 3
3
votes
1 answer

Get all grid values on a diagonal line from point to point in xarray

I'm looking to select all data from an xarray dataset that is between one point and another. This is of course easy with sel for example with a dataset based on a lat/lon grid to subset from a global dataset to the Atlantic coastline I can do…
clifgray
  • 4,313
  • 11
  • 67
  • 116
3
votes
1 answer

ArtistAnimation using contourf for model plots

Does ArtistAnimation work when using the "contourf" method? I'm trying to build an MP4 animation of a model forecast. I'm using an approach similar that is similar to that shown on one of the MetPy Monday video series where you append the plots to…
3
votes
1 answer

transforming to/from earth relative and grid relative for flow vectors in metpy

I've tried looking through the source code, but there doesn't seem to be support for this in MetPy. For example, I have a set of wind vectors relative to the Earth coordinate system (speed, direction) which I want to transform to (u,v) relative to a…
3
votes
4 answers

ModuleNotFoundError: No module named '_lzma'

I am trying to plot in metpy with the help of "xarray with MetPy Tutorial". For that, I am getting error when am running following modules in: 'import cartopy.crs as crs' 'import cartopy.feature as cfeature' 'import matplotlib.pyplot as…
sai nani
  • 31
  • 1
  • 2
3
votes
1 answer

Plotting MetPy Q-vectors

I'm having trouble plotting Q-vectors from metpy.calc from GFS data; I can't get the vectors to plot correctly when applying the ax.set_extent and ax.quiver Calculation code: import metpy.calc as mpcalc query.variables('Temperature_isobaric',…
3
votes
2 answers

Reprojecting Xarray Dataset

I'm trying to reproject a Lambert Conformal dataset to Plate Carree. I know that this can easily be done visually using cartopy. However, I'm trying to create a new dataset rather than just show a reprojected image. Below is methodology I have…
James
  • 149
  • 1
  • 10
2
votes
1 answer

calculate the partial derivatives of temperature (horizontal advection of temperature)

I would like to know which way is the most correct to calculate the partial derivatives of temperature in the x and y directions (horizontal advection of temperature) The second code used the data matrix of temperature, zonal wind and meridional…
leojim19
  • 29
  • 4
2
votes
2 answers

Adding secondary y axis using python matplotlib with metpy

I know this question seems similar to a lot of other questions here, but I've tried them and unfortunately none of them are addressing the problem I'm currently facing when trying to add a secondary y-axis. The problem is quite simple, but I can't…
PhilippeTh
  • 43
  • 7
2
votes
1 answer

Python value error: operands could not be broadcast together with shapes (732,25,17,33) (25,732,17,33) - coordinates of xarray switched?

I am trying to calculate the dewpoint temperature with the metpy function metpy.calc.dewpoint_from_specific_humidity(pressure, temperature, specific humidity) from ERA5 gridded data, however I get an error: ds =…
Lena
  • 35
  • 4
2
votes
1 answer

How to mask data that appears in the ocean using cartopy and matplotlib

Not at all sure what I'm doing wrong besides perhaps the order that I am plotting the ocean in. I am trying to get the ocean feature in to mask the data in the ocean. I am trying to get data to not appear in the ocean and to get the…
Wx_Trader
  • 77
  • 7
1
2 3
14 15