You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had trouble installing earthkit so I created a new environment and was able to finally successfully install it. But then trying to run the code (see box below), I am unable to get it to run. The error messages come as soon as I try to import earthkit as ek.
conda create -n earthkit_env python=3.9
conda activate earthkit_env
conda install -c conda-forge gdal
pip install earthkit
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/spyder_kernels/customize/utils.py:209 in exec_encapsulate_locals
exec_fun(compile(code_ast, filename, "exec"), globals)
File ~/Documents/python_codes/vorticity.py:8
import earthkit as ek
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/earthkit/init.py:22
import earthkit.plots as plots
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/earthkit/plots/init.py:20
from earthkit.plots import styles
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/earthkit/plots/styles/init.py:22
from earthkit.plots import metadata, styles
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/earthkit/plots/metadata/init.py:15
from earthkit.plots.metadata import formatters, labels, units
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/earthkit/plots/metadata/formatters.py:24
from earthkit.plots.schemas import schema
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/earthkit/plots/schemas.py:21
from earthkit.plots._plugins import PLUGINS
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/earthkit/plots/_plugins.py:7 in register_plugins
for plugin in entry_points(group="earthkit.plots.plugins"):
TypeError: entry_points() got an unexpected keyword argument 'group'
What are the steps to reproduce the bug?
import earthkit as ek
import numpy as np
import xarray as xr
Define the variables and regions,use the 10m winds
What happened?
I had trouble installing earthkit so I created a new environment and was able to finally successfully install it. But then trying to run the code (see box below), I am unable to get it to run. The error messages come as soon as I try to import earthkit as ek.
conda create -n earthkit_env python=3.9
conda activate earthkit_env
conda install -c conda-forge gdal
pip install earthkit
%runfile /Users/stroeve/Documents/python_codes/vorticity.py --wdir
Traceback (most recent call last):
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/spyder_kernels/customize/utils.py:209 in exec_encapsulate_locals
exec_fun(compile(code_ast, filename, "exec"), globals)
File ~/Documents/python_codes/vorticity.py:8
import earthkit as ek
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/earthkit/init.py:22
import earthkit.plots as plots
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/earthkit/plots/init.py:20
from earthkit.plots import styles
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/earthkit/plots/styles/init.py:22
from earthkit.plots import metadata, styles
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/earthkit/plots/metadata/init.py:15
from earthkit.plots.metadata import formatters, labels, units
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/earthkit/plots/metadata/formatters.py:24
from earthkit.plots.schemas import schema
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/earthkit/plots/schemas.py:21
from earthkit.plots._plugins import PLUGINS
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/earthkit/plots/_plugins.py:20
PLUGINS = register_plugins()
File ~/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages/earthkit/plots/_plugins.py:7 in register_plugins
for plugin in entry_points(group="earthkit.plots.plugins"):
TypeError: entry_points() got an unexpected keyword argument 'group'
What are the steps to reproduce the bug?
import earthkit as ek
import numpy as np
import xarray as xr
Define the variables and regions,use the 10m winds
u_variable = "10u"
v_variable = "10v"
time_range = "2023-01-01T00:00:00Z/2023-01-31T23:59:59Z"
Fetch the data
u_data = ek.dataset("era5", time=time_range, variable=u_variable)
v_data = ek.dataset("era5", time=time_range, variable=v_variable)
Combine u and v data into one dataset
wind_data = u_data.merge(v_data)
Calculate vorticity
Assuming wind_data is a 2D grid with dimensions (time, lat, lon)
dx = np.deg2rad(wind_data.lon.diff('lon')) # Longitude spacing in radians
dy = np.deg2rad(wind_data.lat.diff('lat')) # Latitude spacing in radians
du_dy = wind_data['10u'].diff('lat') / dy
dv_dx = wind_data['10v'].diff('lon') / dx
vorticity = dv_dx - du_dy
Add vorticity to the dataset
wind_data['vorticity'] = vorticity
Define the regions for averaging
arctic_bounds = (60, 90, 0, 360) # (lat_min, lat_max, lon_min, lon_max)
beaufort_bounds = (70, 80, 240, 300) # (lat_min, lat_max, lon_min, lon_max)
Function to calculate average vorticity over a specified region
def average_vorticity(data, bounds):
lat_mask = (data.lat >= bounds[0]) & (data.lat <= bounds[1])
lon_mask = (data.lon >= bounds[2]) & (data.lon <= bounds[3])
region_data = data.where(lat_mask & lon_mask, drop=True)
return region_data['vorticity'].mean()
Calculate averages
arctic_avg_vorticity = average_vorticity(wind_data, arctic_bounds)
beaufort_avg_vorticity = average_vorticity(wind_data, beaufort_bounds)
Version
Name: earthkit Version: 0.8.0 Summary: A format-agnostic Python interface for geospatial data Home-page: https://github.com/ecmwf/earthkit/ Author: Author-email: "European Centre for Medium-Range Weather Forecasts (ECMWF)" [email protected] License: Apache License Version 2.0 Location: /Users/stroeve/opt/anaconda3/envs/earthkit_env/lib/python3.9/site-packages Requires: earthkit-data, earthkit-geo, earthkit-meteo, earthkit-plots, earthkit-regrid, earthkit-transforms
Platform (OS and architecture)
I'm running MacOSMonterey 12.3.1
Relevant log output
Accompanying data
No response
Organisation
No response
The text was updated successfully, but these errors were encountered: