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
1
vote
1 answer

Having Trouble Optimizing input parameters to MetPy's interpolate_to_grid

I am using Metpy's interpolate_to_grid function to plot contours for US upper air station data. I have been getting odd results using the "cressman" and "barnes" interpolation methods, as will be seen below. I believe these methods should give…
gdlewen
  • 73
  • 4
1
vote
3 answers

MetPy geostrophic wind for WRF data

Edit: I'm starting to suspect the problems arising below are due to the metadata, because even after correcting the issues raised regarding units mpcalc.geostrophic_wind(z) still issues warnings about the coordinates and ordering. Maybe the function…
1
vote
1 answer

Issue plotting grib2 file using xarray and metpy resulting in nearly blank map

Trying to plot HRRR data using MetPy imported through Herbie and inserted into XArray. I am plotting the geopotential height at 700mb with a ContourPlot on a MapPanel. Below, I have inserted the code and the XArray with the data. The output is just…
radarscan
  • 11
  • 1
1
vote
1 answer

How to calculate divergence of vector field on a rotated grid in Metpy?

I need to calculate the divergence of u(M,N) and v(M,N) from a limit-area-model with a rotated grid. Here u and v are the x- and y-component of the wind. The latitude and longitude of the grid are given in 2D arrays: lats(M,N) lons(M,N). Should I…
Ruping Mo
  • 11
  • 1
1
vote
1 answer

Converting lat/lon coordinates into meters/kilometers for use in a metpy HRRR cross section

I am trying to create custom cross sections of archived HRRR Grib2 output data. I had been following the cross section example provided here and followed up on all issues I had with the file format itself also on the unidata site here. I have…
1
vote
1 answer

How to calculate Vertical Integration of moisture flux convergence in Python?

I'm new to python, I calculated the Moisture Flux Divergence [MFD] (i.e. {d(qu)/dx}+{d(qv)/dy} ,q is specific humidity and u,v are zonal and meridional wind components) over India at pressure level 850 hPa using metpy.calc function HMC_LE =…
1
vote
1 answer

how to make a cross section of frontogenesis by metpy

I want to make a cross section of frontogenesis my code is domain_1 = os.path.abspath(filenames_in) info = os.path.join(domain_1, filename) data = xr.open_dataset(info) data = data.metpy.parse_cf().squeeze() print(data) p1 =…
1
vote
1 answer

MetPy Wet Bulb Temperature function returns error when output of Most Unstable Parcel function is used as input

When attempting to use the find the wet-bulb temperature for a parcel returned by MetPy's most_unstable_parcel function, I am getting an error that seems to be related to the Pint attributes of the most unstable parcel pressure. It is necessary to…
gdlewen
  • 73
  • 4
1
vote
1 answer

metpy import issue in Debian 10

I am running python3 on a Debian 10 (buster) system. Up until yesterday, I was able to perform this import: from metpy.plots import (StationPlot, StationPlotLayout, wx_code_map, current_weather) After a general package update, I can no longer…
Stacy
  • 43
  • 7
1
vote
1 answer

Got TypeError: got an unexpected keyword argument 'dim_order' when calculating Temperature advection with Metpy?

I was recreating the code from Metpy Case Study using ERA5 data. But calculating advection I got this error: TypeError: got an unexpected keyword argument 'dim_order' Here is my full code using colab link:…
1
vote
1 answer

metpy cross_section function does not recognize coordinates in ERA5

I use the ERA5 dataset in order to plot a cross section of vertical velocity over southern Africa. A sample of the data is found here. I try to replicate the example given here, however, the cross_section function does not work, as there is missing…
1
vote
1 answer

Unit issue with MetPy's parcel_profile function

I have been working on programming to plot Skew_Ts from Wyoming's weather servers. The issue I am having is I get an error when attempting to run the parcel_profile function, it says it can not convert from dimensionless to hectopascals. The…
WX_Fast
  • 11
  • 2
1
vote
1 answer

metpy skewT 'Line2D' object has no property '' error

I'm just trying to set up a code to plot a skewT graph, but the code falls over immediately on the very first call to set up the graph incidence import matplotlib.pyplot as plt from metpy.plots import SkewT skew=SkewT() gives me the following…
ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
1
vote
1 answer

grid_x and grid_y dimension in natural neighbour to grid?

From the docs https://unidata.github.io/MetPy/latest/api/generated/metpy.interpolate.natural_neighbor_to_grid.html I have my xp, yp, variable points etc similar to how you would do it in mpl mlab gridder or scipy interpolate, but how is the…
Wboy
  • 2,452
  • 2
  • 24
  • 45
1
vote
1 answer

How to fix an Metpy/mpcalc error: "InvalidSoundingError: Pressure does not decrease monotonically in your sounding."

I'm trying to plot a Skew-T of a sounding data and calculate the LFC,LCL using Python but it's giving me an error: InvalidSoundingError: Pressure does not decrease monotonically in your sounding. Using scipy.signal.medfilt may fix…
Judit B
  • 13
  • 2