Define your own latitude and longitude projection

I am converting (rotating) vectors from Lambert to latlon (and viceversa) in Python. But in Basemap or Cartopy, I see that you do not define the lat and lon projections, you just define your Lambert, but the system always take lat and lon as (I guess) the WGS-84 datum. For example, from this example here (https://stackoverflow.com/questions/8878564/how-can-i-rotate-vectors-onto-a-basemap-map-projection):

import numpy
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt

# Set up map projection
m = Basemap(llcrnrlon=-15.,llcrnrlat=46.,urcrnrlon=15.,urcrnrlat=59.,
projection='lcc',lat_1=40.,lat_2=50.,lon_0=-50.,
resolution ='l')

# Calculate positions of vectors on map projection
x,y = m(lon,lat)

How can I define my own latitude, longitude system (I want a spherical one, not the ellipsoid of WGS-84) in order to perform the conversions from my Lambert to my latlon? I can use Cartopy, Proj4 or whatever Python tool you suggest.

If you use matplotlib-basemap as you do with your attached code, you already have the functionality of direct and inverse coordinate conversion.

Conversion from (long,lat) to lcc projection:

lon = [8, 10]
lat = [47, 49]
x,y = m(lon,lat)

Computation check, i.e. conversion from lcc (x,y) to (long, lat):

lon2,lat2 = m(x, y, inverse=True)

You will get:

lon2: [8.000000000000005, 9.999999999999995]
lat2: [47.0, 49.00000000000001]

Edit

If you want to use spherical earth with radius = 6370997 m, you can specify that as an option:

m_lcc = Basemap(llcrnrlon=-15.,llcrnrlat=46.,urcrnrlon=15.,urcrnrlat=59.,
projection='lcc',lat_1=40.,lat_2=50.,lon_0=-50.,
resolution ='l', rsphere = 6370997)
• Thank you, but it seems that all this is assuming a lon lat system with the ellipsoid of reference (WPS84), and I want to create a sphere where I define my lat lon. I need that to rotate vectors, as in here: stackoverflow.com/questions/66079254/… Feb 6 '21 at 17:09
• Lat/lon on WGS84 or spherical earth do not make much difference in normal use. What is your use case? Feb 6 '21 at 17:15
• @David Spherical earth option is possible by specifying an option rsphere with value of the earth radius. Feb 6 '21 at 17:26
• That you, @swatchai. Would it be too much if you can check this question here stackoverflow.com/questions/66079254/…? Feb 6 '21 at 18:14