[Tutor] Fwd: Help
Ewen Jamet
ewenjamet73 at gmail.com
Sat Nov 6 22:46:57 EDT 2021
---------- Forwarded message ---------
De : Ewen Jamet <ewenjamet73 at gmail.com>
Date: sam. 6 nov. 2021 à 21:35
Subject: Re: [Tutor] Help
To: Brett Leach <brettlea at me.com>
Hello!!!
Thank you very much for answering, i am in trouble if i don't fix this..
Well the problem is: I use cartopy to plot geophysics data, and cartopy
feature (coastline etc, the map basicaly) are disappearing when I plot the
data, as you can see on the screenshot sent, I can not understand why..
Thank you if you take time to look at this, I would be very grateful.
Best,
Ewen Jamet
Python 3.8.10
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.3 LTS"
NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="
https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
import os
import subprocess
import sys
import numpy as np
import xarray as xr
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from matplotlib.artist import Artist
import time
import datetime
from netCDF4 import Dataset as Dataset
import getpass
import cartopy.crs as ccrs
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
import cartopy.feature as cfeat
from matplotlib import cm
import warnings
warnings.filterwarnings('ignore')
from function_wm import xr_opening, mapCARTOPY
projection = ccrs.LambertAzimuthalEqualArea(central_latitude=90,
central_longitude= -90)
fig=plt.figure(figsize=(25,25))
plt.gca()
cornerx=9024309 #meters, from NL.hdr
cornery=cornerx
newcornerx=cornerx/2.
newcornery=newcornerx
newextent=[-newcornerx,newcornerx,-newcornery,newcornery]
ax1 = fig.add_subplot(221,projection=projection)
ax1.coastlines(lw=1)
#ax1.stock_img()
#ax1.set_extent(newextent,projection)
ax2 = fig.add_subplot(222,projection=ccrs.NorthPolarStereo())
ax2.add_feature(cfeat.COASTLINE,edgecolor='black',zorder=10)
#ax2.set_extent(newextent,ccrs.NorthPolarStereo())
ax3 = fig.add_subplot(223,projection=projection)
ax3.coastlines(lw=1)
#ax3.set_extent(newextent,projection)
ax4= fig.add_subplot(224,projection=projection)
ax4.coastlines(lw=1)
#def anim(i):
name='ice_type_nh_ease2-250_icdr-v2p0_202110181200.nc'
F1=xr_opening(name)
name2='
ice_drift_mosaic_polstereo_sarbased_north_20190101000000-20190102000000.nc.nc
'
F2=xr_opening(name2)
name3='
ice_drift_mosaic_polstereo_sarbased_north_20190104120000-20190105120000.nc.nc
'
F3=xr_opening(name3)
name4='ice_type_nh_ease2-250_icdr-v2p0_202110181200.nc'
F4=xr_opening(name4)
F1['ice_type'].plot(ax=ax1)
ax2.pcolormesh(F2.xc, F2.yc, F2.divergence[0,:,:])
#data['revelant_value'].plot(ax=ax3)
F1['ice_type'].plot(ax=ax4)
Le sam. 6 nov. 2021 à 21:19, Brett Leach <brettlea at me.com> a écrit :
> Please post your code (inline, not as an attachment) with any errors that
> occur, Python version, OS, etc. We need more information to assist you.
>
> Brett Leach
>
> > On Nov 6, 2021, at 7:47 PM, Ewen Jamet <ewenjamet73 at gmail.com> wrote:
> >
> > Hello,
> > Does someone can help me i face an issur with plotting on cartopy and it
> is
> > really important that I achieve that tonight.. i would be really greatful
> > Best
> > Ewen Jamet
> > _______________________________________________
> > Tutor maillist - Tutor at python.org
> > To unsubscribe or change subscription options:
> > https://mail.python.org/mailman/listinfo/tutor
>
>
More information about the Tutor
mailing list