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

MetPy interpolate_to_grid function returning unexpected nan based on data domain

I have been using the "Gridding METAR Observations" example code from MetPy Mondays #154 for some time without any issues. Up until recently, I passed the entire data set without restrictions (except to exclude stations near the South Pole, which…
gdlewen
  • 73
  • 4
1
vote
1 answer

MetPy Level2File Trouble Reading Volume Header

I'm trying to use Level2File to plot data from February of 2002 and I'm getting a number of inconsistent errors. Sometimes I get errors on the call to Level2File depending on which .Z file I'm attempting to plot. Sometimes it's TypeError:…
1
vote
1 answer

Calculation of the mean_pressure_weighted function

The mean pressure weighted function defined here seems to be based on an odd formulation(see code below). Holton(fifth edition ,page 86), and many otheres calculate the sum the of the desired variable multiplied by dp and not by pdp as shown in the…
Kernel
  • 591
  • 12
  • 23
1
vote
1 answer

Calculating total depth of a variable

I have calculated the Moist Brunt-Vaisala frequency. Let's say that the variable is moistb and has a dimension of [height, lat, lon]. I would like to plot the horizontal distribution of the total depth of the moistb. How do I calculate the total…
kiyas
  • 145
  • 10
1
vote
1 answer

GOES-East Full Disk domain realtime imagery does not fit actual data

I'm trying to plot GOES-East full disk data using metpy, and Siphon to download the latest data from the THREDDS data server. However, after comparing my plots with the realtime imagery, ther seems to be a large difference. Below is my code: import…
Souda
  • 63
  • 4
1
vote
2 answers

How to embed MetPy SkewT plot in PyQt5

I want to embed a MetPy SkewT diagram in a PyQT5 GUI. The following code creates a SkewT diagram: import matplotlib.pyplot as plt import numpy as np import pandas as pd import metpy.calc as mpcalc from metpy.cbook import get_test_data from…
Amir
  • 65
  • 1
  • 2
  • 7
1
vote
1 answer

Metpy Cross Section Geodesic

I may be asking the wrong question here, and am far from a matter expert, but when creating a cross section, is it possible to follow a rhumb line? The documentation states it takes a vertical cross-sectional slice along a geodesic through the given…
jroot
  • 320
  • 1
  • 9
1
vote
1 answer

Issue using mpcalc.advection( ) to calculate advection of a scalar field

I'm attempting to follow this training example to calculate QG omega on NCEP/NCAR data but I'm getting hung up on mpcalc.advection(). It appears as if my dx and dy variables are a different shape, but I'm directly following the routine in an online…
1
vote
1 answer

Write metpy calculated variables to netcdf with xarray

I'm getting an error when trying to write the output from a metpy calculation to a netcdf file using xarray: TypeError: Argument 'data' has incorrect type (expected numpy.ndarray, got Quantity) This seems like its a result of metpy including unit…
dp2ski
  • 13
  • 2
1
vote
1 answer

Plotting lat and lon on satellite image using MetPy's Declarative syntax

I am attempting to find a way to visualize the separate regions/phases of the MJO. I believe one way to do so would be by plotting the longitude lines that separate each phase region (at roughly 60E, 80E, 100E, 120E, 140E, 160E, 180), but I am…
bedettmann
  • 23
  • 6
1
vote
1 answer

Python3.8: MetPy issue: declarative plotting of grib2 file plotting blank map

Teaching myself the declarative plotting feature in MetPy, and keep hitting a snag. This comes from trying to apply the declarative plotting package to a grib2 file, after opening via xarray/cfgrib. The data appears healthy, but it seems the the…
wxninja
  • 87
  • 1
  • 8
1
vote
1 answer

Does Metpy recognize pressure levels and pressure level data that are below ground level when providing a height profile?

I am currently working with RAP analysis data within Metpy to calculate various parameters such as SRH, CAPE, etc. I am wondering if Metpy recognizes when pressure levels are below the ground (will automatically ignore the levels where the data is…
njmike
  • 11
  • 2
1
vote
1 answer

How to solve Metpy ('numpy.ndarray' object has no attribute 'to') error when calculating heat index?

I am writing a code to calculate the heat index using Metpy 1.0 library. However, when running the code I am getting this error : 'numpy.ndarray' object has no attribute 'to' How to solve this error. I thoroughly follow the instructions on a…
corp_guy
  • 35
  • 5
1
vote
1 answer

MetPy Level2File error - local variable 'offset' referenced before assignment

Unidata/MetPy has an example on Plotting AWS-hosted NEXRAD Level 2 Data. It starts off with the following: import boto3 import botocore from botocore.client import Config import matplotlib.pyplot as plt from metpy.io import Level2File from…
mk7447
  • 13
  • 3
1
vote
2 answers

Error using metpy.calc.advection : AttributeError: crs attribute is not available

I am working with some atmospheric model outputs available in NetCDF format. I want to calculate Temperature Advection by 850 hPa winds. I tried using the metpy…