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

Why does the xarray reftime key suddenly have a 1 at the end?

I'm downloading GFS data from the Unidata Thredds server using siphon so I can plot it using MetPy. I wrote a script to do this and it worked perfectly yesterday: #Get data using siphon best_gfs =…
Jack Sillin
  • 75
  • 1
  • 9
1
vote
1 answer

Problem importing a custom colortable file

So, I'm trying to import a custom colortable .tbl file via the metpy function metpy.plots.ctables.read_colortable, to plot some radar fields with Py-ART. These are the codes I'm using: from metpy.plots import…
Souda
  • 63
  • 4
1
vote
1 answer

Adding unit attributes to an xarray object

I have created an array of isobaric pressure levels to plot a cross section: vertical, = cross['isobaric'].metpy.coordinates('vertical') however, this array has values in units of Pa. To convert into hPa, I created a new array: vert_hpa =…
Jack Sillin
  • 75
  • 1
  • 9
1
vote
1 answer

How do I get isobaric relative humidity data into 2D array form?

I'm trying to create a contour plot of relative humidity at a constant pressure level (500hPa) similar to that in the MetPy xarray tutorial. I have acquired data using the Siphon package and have parsed it into an array that seems to be 2-D with…
Jack Sillin
  • 75
  • 1
  • 9
1
vote
1 answer

NetCDF Attribute not found when using metpy and siphon to get data

I'm trying to plot some meteorological data in NetCDF format accessed via the Unidata siphon package. I've imported what the MetPy docs suggest are the relevant libraries import cartopy.crs as ccrs import cartopy.feature as cfeature import…
Jack Sillin
  • 75
  • 1
  • 9
1
vote
1 answer

metpy complains file is invalid data

I am trying to use the example script found here to plot a nexrad level 2 file from here but I get an invalid data error. Traceback (most recent call last): File "F:\z0sh\py\NEXRAD_Level_2_File.py", line 28, in f = Level2File(…
jake9wi
  • 131
  • 7
1
vote
1 answer

#metpy - NEXRAD L3 NCR data scaling

I have been trying to determine how the NEXRAD NCR data is scaled. I see from the product header that the max value is 63 but after reading in the datadict, the max value in the data variable is 11. I don't see any info in the Federal Meteorological…
1
vote
1 answer

MetPy and rotated latitude longitude grid from COSMO?

Has anyone here used MetPy with rotated latitude longitude coordinates? Is it possible? What I am trying to accomplish is to make vertical cross sections of my data. I opened my netCDF file with xr.open_dataset: Dimensions: (bnds: 2, level:…
Zane
  • 23
  • 1
  • 5
1
vote
1 answer

How should the function interpolate_to_points of metpy be used?

I want to regrid georeferenced data to a specific grid with a different resolution on the lat and on the lon dimensions. Before I would use basemap.interp, but this basemap is dead. I am experimenting with the metpy package, and…
Pauli
  • 170
  • 3
  • 9
1
vote
3 answers

ModuleNotFoundError: No module named 'cartopy' when import SkewT from metpy.plots under Python3

When trying to import SkewT into my python3 code on a Mac (Mojave 10.14.6): from metpy.plots import SkewT I get the error: ModuleNotFoundError: No module named 'cartopy' pip3 install cartopy gives the output Collecting cartopy Downloading…
Janine
  • 13
  • 2
  • 7
1
vote
2 answers

How to Calculate the Divergence in Metpy?

Would you like to know how the divergence calculation is done in Metpy? We know that in Grads the calculation of divergence is performed by the finite difference method as follows: pi = 3,14159265359 dtr = pi / 180 a = 6,371e6 dx = a * cos…
1
vote
3 answers

ModuleNotFoundError: No module named 'xarray.core.accessors'

I am new to python, and trying to run Metpy tutorial with xarray, before its ok but after I update xarray to newer version then it show an error I have tried to create another environment in anaconda prompt, and install every module including metpy…
1
vote
1 answer

Resolution in Interpolation Scheme

I have a grid template that has grid spacing in hundredths of a degree instead of meters since the projection is lat-lon. What are my options for the hres parameter with the interpolate_to_grid tool/program ? Is it restricted to a value in meters?…
1
vote
1 answer

Resample list of lat lon points

The code below reads in data about the location of valid ASOS (weather observing stations) around the globe. I'd like to use the list in the future as a list of points to plot data from, but a lot of the stations are way too close together to view…
Karl Schneider
  • 466
  • 4
  • 11
1
vote
1 answer

Plot Nexrad level 2 file using Metpy and Pyart, coordinate calculation

I was trying to plot reflectivity data from a same nexrad level 2 file using both Metpy and pyart, and the result seems to be quite different, especially, I see that metpy and pyart calculate the coordinates very differently: In MetPy, the…
Y Tao
  • 11
  • 1