__token__
. The password is stored in ${{ secrets.pypi_token }}
now.
- name: Publish Package
uses: pypa/gh-action-pypi-publish@v1
with:
user: __token__
password: ${{ secrets.pypi_token }}
transform=
argument to your plotting functions with the projection that the data is coming from.
Dear @jadelilymay, I have managed to implement a small code snippet that reads your TIFF file, and plots it using cartopy. See if it helps you. The code is in the file test.py I just sent
Sincerely,
hi, I use Ubuntu, python3.8 pip, pycharm. I have a problem with Cartopy. ModuleNotFoundError: No module named 'cartopy.crs'; 'cartopy' is not a package
r: ~ $ which python
/ usr / bin / python
r: ~ $ python -c 'import sys; print (sys.prefix) '
/ usr
r: ~ $ python -c 'import cartopy.crs as ccrs'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named cartopy.crs
ax.scatter(lon, lat, c=level, transform=ccrs.PlateCarree())
Hello. I would like to know how I can plot on a map the data from the variable "r" (relative humidity) of a NetCDF file with cartopy?
from netCDF4 import Dataset
import numpy as np
import xarray as xr
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
ds=Dataset('relative_humidityEne_Dic2003_2020CMAS.nc', 'r')
print(ds.variables.keys())
lon = ds.variables["longitude"]
lat = ds.variables["latitude"]
level = ds.variables["level"]
time = ds.variables["time"]
r = ds.variables["r"]
print("las dimenciones variable r es: ", ds.variables['r'].dimensions)
print(r.shape)
dict_keys(['longitude', 'latitude', 'level', 'time', 'r'])
las dimenciones variable r es: ('time', 'level', 'latitude', 'longitude')
(53, 8, 241, 480)
ax = plt.axes(projection=ccrs.PlateCarree())
r_ds = ds.variables['r'][0, :, :, :]
plt.contourf(lon, lat, r_ds, transform=ccrs.PlateCarree())
ax.coastlines()
plt.show()
Error message
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 3331, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-403ea023eab8>", line 1, in <module>
runfile('/home/leo/Documentos/Universidad/Trabajo_de_investigación/PerfilesVerticalesContaminantesAtmosfera/Datos/readNetdcf42003_2020CMAS.py', wdir='/home/leo/Documentos/Universidad/Trabajo_de_investigación/PerfilesVerticalesContaminantesAtmosfera/Datos')
File "/snap/pycharm-professional/230/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/snap/pycharm-professional/230/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File"/home/leo/Documentos/Universidad/Trabajo_de_investigación/PerfilesVerticalesContaminantesAtmosfera/Datos/readNetdcf42003_2020CMAS.py", line 65, in <module>
plt.contourf(lon, lat, r_ds, transform=ccrs.PlateCarree())
File "/home/leo/.local/lib/python3.8/site-packages/matplotlib/pyplot.py", line 2577, in contourf
ret = gca().contourf(
File "/home/leo/.local/lib/python3.8/site-packages/cartopy/mpl/geoaxes.py", line 321, in wrapper
return func(self, args, **kwargs)
File "/home/leo/.local/lib/python3.8/site-packages/cartopy/mpl/geoaxes.py", line 1586, in contourf
result = matplotlib.axes.Axes.contourf(self, args, **kwargs)
File "/home/leo/.local/lib/python3.8/site-packages/matplotlib/init.py", line 1447, in inner
return func(ax, map(sanitize_sequence, args), **kwargs)
File "/home/leo/.local/lib/python3.8/site-packages/matplotlib/axes/_axes.py", line 6335, in contourf
contours = mcontour.QuadContourSet(self, args, **kwargs)
File "/home/leo/.local/lib/python3.8/site-packages/matplotlib/contour.py", line 816, in init
kwargs = self._process_args(args, *kwargs)
File "/home/leo/.local/lib/python3.8/site-packages/matplotlib/contour.py", line 1430, in _process_args
x, y, z = self._contour_args(args, kwargs)
File "/home/leo/.local/lib/python3.8/site-packages/matplotlib/contour.py", line 1488, in _contour_args
x, y, z = self._check_xyz(args[:3], kwargs)
File "/home/leo/.local/lib/python3.8/site-packages/matplotlib/contour.py", line 1514, in _check_xyz
x = np.asarray(x, dtype=np.float64)
File "/usr/local/lib/python3.8/dist-packages/numpy/core/_asarray.py", line 102, in asarray
return array(a, dtype, copy=False, order=order)
TypeError: array__() takes no arguments (1 given)
pip install cartopy==0.19.0rc1
pytest path/to/test
and that was not working well because it was trying to make local imports and obviously all generated files where missing
git tag list
instead of git tag -l
to see what the tags were and then pushed up two tags. Luckily it doesn't look like that one did anything though? I don't see it on GH now (I assume you deleted it?) and I deleted my local tag name. Thanks for pointing that out.
transform=ccrs.Geodetic()
keyword.