Questions tagged [metpy]

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

metpy
Filter by
Sorted by
Tagged with
0 votes
1 answer
113 views

MetPy Georeferenced Level 3 Radar Sweep

I am trying to get level 3 data into a georeferenced png Mapbox can use. Mapbox requires a format that im not sure how to implement properly. They use top-right, top-left, bottom-left, and bottom-...
FunguyPro's user avatar
0 votes
1 answer
97 views

MetPy ageostrophic wind script

https://unidata.github.io/python-gallery/examples/Ageostrophic_Wind_Example.html The above script is throwing up an error. Kindly help. Traceback (most recent call last): File "/home/rajkumar/...
Rajkumar S's user avatar
0 votes
1 answer
430 views

Adding annotations for High and Low pressure symbols in Mean Sea Level Pressure field

I'm currently plotting the Mean Sea Level Pressure (MSLP) data from ERA5 Reanalysis (sample netcdf data is included) using the 'recipe' from Unidata. The reproducible code (I tried to be as minimal as ...
CGHA's user avatar
  • 37
0 votes
1 answer
67 views

Metpy Static Stability - MemoryError: Unable to allocate 13.4 GiB for an array with shape (19, 1825, 180, 288) and data type float64

I have downloaded GFDL-ESM model global data for temperature for 2010-2014 period of around 3.5 GB. I want to calcuate static stability using the METPY library. My dataset looks like this Temperature ...
nishant uchale's user avatar
0 votes
1 answer
95 views

Applying spline interpolation for Brunt-Vaisala frequency

I have taken an upper air sounding from UWYo Database and currently calculating the Brunt-Vaisala frequency (the 'squared' one, at the moment) using MetPy across several stations for some basic ...
CGHA's user avatar
  • 37
1 vote
1 answer
238 views

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 ...
radarscan's user avatar
0 votes
1 answer
181 views

Metpy Brunt-Vaisala Frequency feature is returning with NaN

I am using metpy to calculate Brunt-Vaisala frequency and the code is running fine but my array of values is being returned as a bunch of NaN values. I have Pressure and temperature measured at the ...
Sadie's user avatar
  • 1
0 votes
1 answer
168 views

How to serialize metpy (pint) units for use with dask distributed?

How can I properly serialize metpy units (based on pint) to work with dask distributed? As far as I understand, it looks like dask distributed automatically pickles data for ease of transfer, but ...
bwc's user avatar
  • 1,087
1 vote
1 answer
186 views

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 ...
Ruping Mo's user avatar
0 votes
1 answer
229 views

Getting error message while ploting metpy SkewT

I am using WRF output data to plot SkweT, here is code: import wrf from netCDF4 import Dataset import matplotlib.pyplot as plt import numpy as np import metpy.calc as mpcalc from metpy.plots import ...
rock0789's user avatar
0 votes
0 answers
230 views

How to create a cross-section ocean profile from netcdf file?

I would like to create a cross-section of 3D (long, depth, oxygen) along a transect that follows a coastline. E.g. similar to using the MetPy package, however I cannot seem to get the x-y data to work,...
Mere's user avatar
  • 1
1 vote
1 answer
698 views

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 ...
Rakoc1bc's user avatar
2 votes
2 answers
603 views

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-...
PhilippeTh's user avatar
0 votes
0 answers
93 views

How to successfully download Metpy on Spyder?

I'm new to Python so please bear with me (I learned 5 days ago). I've been working on a SkewT diagram using Matplotlib, Metpy, Pandas, and a few others. Whenever I attempt to import metpy,it isn't ...
Sadie's user avatar
  • 1
1 vote
1 answer
3k views

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 ...
Tanu Sharma's user avatar
-1 votes
2 answers
156 views

nan values in interpolated result python metpy

I have a data set with (latitude, longitude, temperature) and I'm trying to interpolate the temperature to graph it with contourf. However, the interpolated has nan values in it (I'm sure that my data ...
QHoang's user avatar
  • 45
0 votes
1 answer
611 views

How to interpolate temperature from a set of data using metpy.interpolate

I'm trying to generate a map using cartopy and metpy.interpolate, and I want the final products to be similar to this picture below Image taken from NDAWN website. I have a set of data with coordinate ...
QHoang's user avatar
  • 45
1 vote
1 answer
221 views

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()....
tianhang zhang's user avatar
0 votes
1 answer
426 views

cannot import name 'AuthorityMatchInfo' from 'pyproj._crs'

I am trying to use the calc module in metpy. I have installed it both via pip and 'conda forge' option. When i run my script in spyder, i get the following error ImportError: cannot import name '...
The Sun's user avatar
2 votes
1 answer
147 views

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 ...
Lena 's user avatar
  • 35
2 votes
1 answer
1k views

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 ...
Wx_Trader's user avatar
0 votes
1 answer
387 views

Metpy: Neither Quantity object nor its magnitude has attribute 'ax'

I'm working with some sizeable data, with variables temp, dewpt, pressure, u_wind, and v_wind. There are thousands of days of data, and I found several percentiles of the data, and am looking to ...
matrix_season's user avatar
0 votes
1 answer
369 views

Coordinate alignment off when using Metpy assign_y_x coordinates with manual CRS

I am having issues with the function that assigns y and x coordinates values for grid mapping. Essentially my end goal is to be able to extract grid values from a given set of lat/lon pairs, which ...
Cane89's user avatar
  • 3
1 vote
1 answer
152 views

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 ...
gdlewen's user avatar
  • 73
1 vote
1 answer
105 views

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 ...
Stacy's user avatar
  • 43
1 vote
1 answer
989 views

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 ...
Tahmidul Azom Sany's user avatar
1 vote
1 answer
445 views

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 ...
Maria Chara Karypidou's user avatar
0 votes
0 answers
11 views

metpy.calc.wind_direction ValueError: Boolean index assignment in Dask expects equally shaped arrays [duplicate]

I have several netCDF4 files containing different times and variables that I stacked in a unique xarray Dataset to compute different sounding parameters. I have been able to use other metpy.calc ...
ADM's user avatar
  • 13
1 vote
1 answer
296 views

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 ...
WX_Fast's user avatar
  • 11
0 votes
1 answer
600 views

Getting a "ValueError: zero-size array to reduction operation minimum which has no identity" when using metpy cape_cin function

I'm trying to calculate cape and cin in a specified layer using metpy's cape_cin and get_layer functions. Im doing this for a RAP vertical profile that I access from the NCDC server, for 3 different ...
Kyle Pittman's user avatar
0 votes
1 answer
170 views

Interpolate_to_grid returns all nans

Practicing with MetPy Monday interpolate_to_grid for metar data and I successfully got the mslp grid to work. Moving on to Potential temperature and the result has been all nan. When it "works&...
jimmyc's user avatar
  • 1
0 votes
1 answer
196 views

adding mixing lines across all pressures in skewT metpy

I can plot a standard SkewT chart with mixing lines up to the default of p=600hPa, using the default call plot_mixing_lines() But I wanted to extend them up to the upper troposphere. I tried to do ...
ClimateUnboxed's user avatar
0 votes
0 answers
34 views

Kernel dying in Jupyter notebooks with metpy

running any metpy function is fine till plotting when the kernel repeatedly dies. I think this may be a hardware issue but curious for answers
Stephen Madorin's user avatar
1 vote
1 answer
422 views

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 ...
ClimateUnboxed's user avatar
2 votes
1 answer
262 views

Getting Value Error for Latitude Argument When Trying to Plot Absolute Vorticity in metpy?

I'm trying to plot a 500 hPa vorticity and keep running into a valueerror and haven't been able to figure it out. Have tried several ideas, including ones from my instructor, and still hasn't worked. ...
Northern FireWx Chaser's user avatar
1 vote
1 answer
134 views

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 ...
Wboy's user avatar
  • 2,492
3 votes
2 answers
998 views

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 ...
Jared Lee's user avatar
1 vote
1 answer
454 views

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 ...
Judit B's user avatar
  • 13
2 votes
1 answer
561 views

How to use vorticiy calculation in metpy version 1.0?

I want to used metpy.calc.vorticity. Previously, its structure was (u, v, dx, dy), but change to (u, v, *, dx=None, dy=None, x_dim=- 1, y_dim=- 2). What is * at the new structure? When I use (u, v), ...
Ehsan's user avatar
  • 53
2 votes
1 answer
636 views

How to apply MetPy's cross section analysis to a data set with 2-dimensional lat and lon?

I have 4-dimensional data (time, depth, y, and x), but the latitude and longitude are both 2d arrays. y and x are just the indices, so just integers going from 0, 1...end etc. Very similar to the ...
wabash's user avatar
  • 799
1 vote
1 answer
230 views

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 ...
gdlewen's user avatar
  • 73
2 votes
2 answers
1k views

Moisture flux divergence using numpy and metpy differ

As described in this question I want to calculate moisture flux divergence at 850 hPa. For this, I have used the code described here, which makes use of the np.gradient function from the numpy package....
Maria Chara Karypidou's user avatar
2 votes
1 answer
2k views

How to calculate moisture flux divergence in python

I want to calculate moisture flux divergence (MFD) over southern Africa. I use u and v wind components at 850 hPa and specific humidity at 850 hPa, for a specific day. I have followed the steps ...
Maria Chara Karypidou's user avatar
1 vote
1 answer
74 views

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 ...
Ryan Connelly's user avatar
0 votes
1 answer
42 views

Error creating Satellite images from THREDDS server after MetPy 0.12->1.1 upgrade

Upgraded MetPy to 1.1 and my ability to produce satellite images from a THREDDS server is no longer working. I isolated the part that is causing me issues. Example: #!/usr/bin/python3 import metpy ...
djb's user avatar
  • 1
0 votes
2 answers
2k views

Which formula is used to calculate relative humidity from dewpoint with metpy?

I am using MetPy to calculate relative humidity from dewpoint and temperature. The resulting data looks pretty good, with values between 0.23 and 0.95 (intuitively seems to be ok). My problem is, ...
Hanna Beatriz Wollmeister Muoz's user avatar
4 votes
1 answer
732 views

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 ...
gdlewen's user avatar
  • 73
1 vote
1 answer
505 views

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 ...
Kernel's user avatar
  • 611
1 vote
1 answer
135 views

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 ...
kiyas's user avatar
  • 155
0 votes
1 answer
36 views

Best place to start finding out more background on the NDFD forecast?

My apologies for not asking a programming related question, but I'm not sure where else to start. I have been making animation plots of the NDFD rainfall forecast, and I am noticing a lot of curious ...
Chris Ranck's user avatar