Questions tagged [metpy]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
32 views

GeometryCollection' object is not subscriptable gfs.t1xz.pgrb2.0p25.f00x

Error ( TypeError: 'GeometryCollection' object is not subscriptable ) when creating the figure with global GFS data gfs.t1xz.pgrb2.0p25.f00x. With some files I don't get this error. The error is in ...
leojim19's user avatar
0 votes
1 answer
19 views

Why is this index error occurring with MetPy?

I tried to calculate an index such as LCL using Metpy. The following is the result of trying print(p, t, td). [34.5 30.0 29.1 25.6 20.0 19.9 16.4 15.1 12.0 10.3 10.1] hectopascal [-56.3 -56.1 -56.9 -...
kim's user avatar
  • 1
1 vote
0 answers
61 views

Invert the Laplacian of a 2D fixed grid data array

I want to invert the Laplacian on a 2d fixed grid in python, which was possible to do in ncl using the ilapsf function. I don't really want to try and do this from scratch using a convolution and ...
ClimateUnboxed's user avatar
0 votes
1 answer
34 views

Issue in metpy imports

I installed metpy with pip in order to plot a skewT diagram. I have the following issue when I try to import metpy packages: File "/home/straussc/Documents/stage2A/observations/programmes/...
Methil's user avatar
  • 1
0 votes
0 answers
35 views

Meteo station point data to raster interpolation in Python, pandas and geopandas

I'm looking for assistance to solve a spatial Kriging problem in Python (or any other solution you might suggest) that involves integrating multiple variables from the columns of the same dataframe ...
Stefano's user avatar
0 votes
0 answers
29 views

ValueError on calculating 0-3 km AGL CAPE in Metpy

I'm currently having a trouble on calculating CAPE in the first 3 km AGL extracted from a model. For some digging, attached here is the sample data I'm using. Initially, I used Metpy's get layers ...
CGHA's user avatar
  • 37
0 votes
0 answers
29 views

Metpy interpolate_to_isosurface returning an array of nan values

I have arrays of potential vorticity and potential temperature values on isobaric coordinates, and I am trying to interpolate potential temperature onto an isosurface of potential vorticity. The ...
user22506984's user avatar
0 votes
1 answer
67 views

How to Create a Straight Line Cross-Section Plot in MetPy with Xarray Dataset?

I am trying to create a cross-section plot using MetPy and xarray for a variable stored in a data xarray.Dataset. However, the cross-section line appears curved when using longitude-latitude pairs, as ...
abhiH's user avatar
  • 1
1 vote
1 answer
48 views

Temperature array difference for MetPy

I'm trying to use a metpy script to make Skew-T diagram. My source data uses the Dew Point Depression (dewpt) parameter and the original script uses the Dew Point (Td) parameter. Knowing the ...
Marina's user avatar
  • 13
0 votes
1 answer
76 views

How metpy module calculate Moisture flux divergence in python

I am calculating moisture flux divergence using metpy module in python. I calculated it like ` import xarray as xr import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as ...
Sreeshma's user avatar
0 votes
1 answer
62 views

How can I add the value in every point to a Contour Plot?

Right now I'm using matplotlib to generate contour plots of climatic variables. Now I wanted to add the numeric value on each point so that the final plot looks something like this: So, I was ...
jnava1612's user avatar
2 votes
1 answer
108 views

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 ...
leojim19's user avatar
-1 votes
1 answer
44 views

calculate the MCS index

I would like to optimize the code to calculate the MCS index for the Southern Hemisphere using the formula ( # SA − MCS index = [Shear (0–6 km) –20.01] ∕7.87 + [ gradiente_horizontal (775 hPa) –4.84 × ...
leojim19's user avatar
0 votes
2 answers
96 views

How to use 1D function metpy.parcel_profile in xarray dataset open with dask

I can't calculate parcel_profile (1D function) on an xarray dataset (segmented with dask) in 4D. Hello, I really need help, I'm working on ERA5 hourly data on pressure levels. I've extracted relative ...
nietreil's user avatar
1 vote
1 answer
39 views

metpy cross_section function gives nan in output

I'm trying to use metpy to take a cross-section of oceanographic data, because I'm not managing with the OceanSpy package and don't know if there are other packages more suitable for doing this. ...
emmadd's user avatar
  • 13
1 vote
2 answers
119 views

Is there a method to convert a Metpy output to numpy variable

I calculated the wind direction using Metpy. How can I extract the values and use the values as input in another part of my program? In the sample code below, I would like to display the direction as ...
Tee's user avatar
  • 41
1 vote
1 answer
32 views

Gridding data to edge of bounds

I have some scatter data of mesonet stations and I want to generate maps for a specific variable. I first want to grid the data and store it in a NetCDF for repeated access. I'm using metpy to ...
deadpickle's user avatar
0 votes
1 answer
78 views

The laplacian of metpy can't convert the units of temperature advection

i received recently a work from university to calculate all terms of Sutcliffe equation, and now i trying to do this in python. But, for the Temperature Advection term, i need to do the laplacian of ...
Pedro Lucas Oliveira Pinto's user avatar
0 votes
1 answer
180 views

How to vertically integrate over a region with different integral bounds at every lat lon point?

I am trying to calculate the vertical integral of the horizontal advection of Moist Static Energy uisng ERA5 data over a particular region. I am using xarray hence I know how to interpolate and ...
Rakshith's user avatar
1 vote
1 answer
32 views

Can height rises/falls be added to the station plots in a DIFAX chart replica?

First, I would like to thank Kevin Goebbert and the MetPy team for providing this very helpful Python code for creating a DIFAX chart replica: https://unidata.github.io/python-gallery/examples/...
jtmcleod1989's user avatar
0 votes
1 answer
67 views

What's the right code to include a legend in my Python map for threat categories of SPC convective outlook using Matplotlib panel plot?

I've written a code to plot an SPC convective outlook. I have the map created, cities, states, lakes, etc., that I want on there. I also want to put a legend for the map as well outlining the ...
wxgeek15's user avatar
1 vote
1 answer
174 views

How to resolve 'module 'metpy' has no attribute 'calc'' error when using MetPy in Python?

I have got this error with metpy: AttributeError: module 'metpy' has no attribute 'calc' The code is as follows; import metpy as mp import numpy as np from metpy.units import units df = pd.read_csv('...
tok's user avatar
  • 13
0 votes
2 answers
60 views

Metpy Precipitable Water Given Arguments with Incorrect Units

I am trying to do a simple calculation using Metpy's precipitable water function. The code below matches their example: import metpy.calc as mpcalc from metpy.units import units import ...
bayouwxman's user avatar
1 vote
1 answer
86 views

Plotting the Parcel Virtual Temp Profile in Metpy 1.5

MetPy 1.5.0 was rolled out earlier today and I get the chance to test out the virtual temperature corrected CAPE/CIN thermo parameters. But, upon trying it out on my end with my novice skills as seen ...
CGHA's user avatar
  • 37
1 vote
1 answer
63 views

Why is mixing ratio at LCL not the same as for starting condition?

I'm very new to metpy. As a first example I tried to calculate the LCL of an air parcel with T=25°C, p=950hPa and relative humidity=70%. First, the mixing ratio of this air is calculated to be mr: ...
MichaelW's user avatar
  • 1,338
1 vote
2 answers
396 views

Plotting Colorized Map of Specific US Counties with Cartopy - Python

I am attempting to plot colored US counties based on some data, using Cartopy. I have created a dataset of FIPS codes and the count of 1950-2022 tornadoes for the state of Michigan. I have it in a ...
Kyle Gillett's user avatar
0 votes
1 answer
186 views

How to calculate moist adiabatic lapse rate using metpy?

I am wondering to calculate the moist adiabatic lapse rate using metpy function moist_lapse. But this function results a lapse value at each pressure level instead a single lapse rate value across ...
hbkumar's user avatar
  • 45
0 votes
1 answer
39 views

Ask if value CAPE and most unstable CAPE are Same

Metpy admin, I curious what causes the value of CAPE and most unstable CAPE are same? Latest, I try to count CAPE and MCAPE use ERA5 data. Best regards
Novvria Sagita's user avatar
1 vote
1 answer
38 views

Type hints for MetPy quantities

I am trying to use type hints throughout my code. For metpy quantities, I find this to be quite hard as they inherit from pint. If I check the type of the quantities I am using I find out that they ...
Steffen Beirle's user avatar
0 votes
0 answers
33 views

The function is already defined in a previous cell but error says it is not defined

I am using jupyter notebook. The following code uses some functions defined in the metpy package (dewpoint_from_relative_humidity) to define a new function "calc". import numpy as np import ...
piyush's user avatar
  • 29
0 votes
1 answer
52 views

metpy get_layer returns only the the first three values

All, The MetPy get_layer function returns only the first 3 pressure values from the following pressure array (is that is correct?) import numpy as np from metpy.calc import get_layer plev = np.array(( ...
Kernel's user avatar
  • 601
1 vote
1 answer
35 views

What is the unit of NEXRAD DPR L3 products when reading with MetPy?

I am currently working with DPR L3 products from NEXRAD and reading them with the metpy library. As far as I understand, the data should be stored as 16-bits integers, but the values are way higher ...
acolin's user avatar
  • 11
0 votes
0 answers
56 views

using metpy package to find the moist_static_energy of different variables of temeparture, height and specific himifty

Code: mi =[] for T in np.array(df_use['TEMP']): for z in np.array(df_use['HGHT']): for q in qv: moist_stat_energy = moist_static_energy(z* units.meters,T* units.degC, q * units(...
Matilda Achaab's user avatar
1 vote
1 answer
93 views

Parallelizing CAPE calculation using metpy function and multi-processing pool

I have tried using pool.map() and pool.allpy() for parallelizing the CAPE estimation but getting errors, below is the code I have been running: import multiprocessing from multiprocessing import ...
piyush's user avatar
  • 29
1 vote
1 answer
51 views

Why does subtraction of two units.degC quantities give a units.delta_degC result but subtracting two units.kelvin gives a units.kelvin result in metpy

I'm a metpy user. I was calculating the unit of temperature using metpy. I found one difference in the process of subtraction. For Celsius and Fahrenheit temperatures, subtracting or adding values ...
이수현's user avatar
0 votes
1 answer
103 views

Plot of a potential temperature line using metpy

I’m trying to plot a potential temperature line that passes through the point located by the temperature and pressure of an air parcel on a “skew T - lnp” chart. As far as I understood, metpy provides ...
Fabrizio's user avatar
0 votes
0 answers
169 views

Trying to install metpy in my machine but getting error

Metpy 1.4 got installed but when imported it is showing error even after update ModuleNotFoundError: No module named 'xarray.core.accessors'. I was trying to work with Metpy, although the ...
Vineet Sharma's user avatar
-1 votes
1 answer
67 views

Metpy sounding for data just above the surface

I'm using Metpy to create sounding profiles of data I have. The data itself only goes up to about one kilometer above the surface. Is there a way to visualize this on a sounding using Metpy? I'm ...
matrix_season's user avatar
0 votes
1 answer
88 views

Type of interpolation used with metpy interpolate_to_isosurface

I'm wondering what type of interpolation scheme is used when calling interpolate_to_isosurface from metpy ? I'm trying to interpolate a numerical atmospheric model and a set of data from a satellite ...
Kwilkyy's user avatar
0 votes
0 answers
196 views

Assign_crs and assign_y_x to an xarray dataset that contains a data variable created by MetPy's interpolate_to_grid

I have an xarray dataset that contains a data variable 'tmpc_obs' that was created using the interpolate_to_grid function within MetPy. I would like to be able to interpolate specific point values ...
Cane89's user avatar
  • 3
1 vote
1 answer
172 views

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 ...
gdlewen's user avatar
  • 73
1 vote
3 answers
597 views

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 ...
n0rthern.dancer's user avatar
0 votes
1 answer
170 views

Python way of plotting a Tephigram and Hodograph

I am looking to plot a Tephigram using Python and so far I have noticed that there are no real ways of doing so and I do not have the meteorological training to start from a SkewT plot and customize ...
Curious's user avatar
  • 393
0 votes
1 answer
77 views

metpy.calc error, absolutely no clue on what to do

I'm using the import metpy.calc package to find the absolute momentum of wind given it's u and v components. The problem is that even though the u and v xarray are identical, metpy keeps saying they ...
Finest Whiskey's user avatar
0 votes
1 answer
88 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
86 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
351 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
57 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
83 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
160 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

1
2 3 4 5