Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Cartopy: latitude axis gridlines disappear when stand_lon is changed in namelist.wps

Abierto
#132 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python

Línea de trabajo

Comienza reproduciendo el flujo de trabajo de trazado de Python Cartopy descrito en el issue utilizando la salida de WRF geogrid.exe y namelist.wps con diferentes valores de stand_lon. Compara las etiquetas de las líneas de cuadrícula de latitud con las etiquetas de longitud y determina si el recorte se produce en wrf-python o en la dependencia de trazado; se considera terminado cuando las etiquetas de latitud sigan siendo visibles para la configuración de proyección indicada.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Hi!

I was unsure whether to share this on the Cartopy Github page, but because the issue occurs due to a change related to WPS, it seemed appropriate to bring it up here.

I am using Cartopy 0.18.0 to plot out my WRF domains on a map. My process is running geogrid.exe and then executing a Python script that calls Cartopy to create the basemap.

In namelist.wps, I have been toying with the stand_lon variable - I would like it to deviate largely from ref_lon. However, when I set the value to be far enough away from ref_lon, run geogrid.exe, then try to plot the basemap with domain boxes overlaid, the latitude axis labels disappear! I want to have a much higher stand_lon so that my domains exclude higher-level terrain (the Rockies).

I use matplotlib.ticker.FixedLocator (Matplotlib 3.3.2) to add specific y-axis labels, but the issue seems to occur regardless of what tick method I choose. This is a specific issue for the y-axis only, as the longitudes on the x-axis seem fine. I did a test to see the extent of the problem by plotting a bunch of latitudes - and there seems to be a cutoff where Cartopy stops adding axis labels. Strange!

Initial figure: stand_lon = -123.5 = ref_lon
my_domain_1

Final figure: stand_lon = -88.5, ref_lon = -123.5
my_domain_2

Below are some lines of code connected to this problem.
Thanks so much for your help!

  • Anthony

` import cartopy.crs as ccrs
from cartopy.feature import BORDERS, COASTLINE, COLORS, LAKES, NaturalEarthFeature
from matplotlib.ticker import FixedLocator, MultipleLocator
import numpy as np

states = NaturalEarthFeature(category='cultural', scale='50m', name='admin_1_states_provinces_shp', facecolor='none')
ax.add_feature(states, edgecolor='k', linewidth=0.3)
ax.add_feature(COASTLINE, edgecolor='k', linewidth=0.5)
ax.add_feature(LAKES, edgecolor='k', facecolor='none', linewidth=0.5)
ax.add_feature(BORDERS, edgecolor='k', linewidth=0.5)

minlon = int(5*np.ceil(lons[(0,0)]/5))
maxlon = int(5*np.ceil(lons[(0,-1)]/5))
minlat = int(4*np.floor(lats[(0,0)]/4))
maxlat = int(4*np.ceil(lats[(-1,0)]/4))
lonticks = range(minlon,maxlon+1,5)
latticks = range(minlat,maxlat+1,4)

glnolabs = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=False, linewidth=1.5, linestyle='--')
glnolabs.xlocator = MultipleLocator(base=5)
glnolabs.ylocator = MultipleLocator(base=5)

gl = ax.gridlines(crs=ccrs.PlateCarree(), draw_labels=True, linewidth=1.5, linestyle='--')
gl.top_labels = False
gl.right_labels = False
gl.x_inline = False
gl.y_inline = False
gl.xlocator = FixedLocator(lonticks)
gl.ylocator = FixedLocator([40,41,42,43,44,45,46,47,48,49,50,51,52])

gl.xlabel_style = {'size':lblsz,  'color':'black',  'rotation':0}
gl.ylabel_style = {'size':lblsz,  'color':'black',  'rotation':0}

`

Lenguaje dominante
Python
Estrellas
498
Forks
178
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de NCAR/wrf-python

Todos los issues de NCAR/wrf-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.