-1

I have the coordinates of the four corner of my domain in rotated coordinate. These are rlons: -25.6, 32.48, -25.6, 32.48

rlats: -27.6, -27.6, 26.08, 26.08

the rotated north pole is lon -170, lat 40

First I have to transform the corners from rotated co-ordinate to geographical coordinate.

after transformation, the actual geographical coordinates are

lons: -13.7893,39.6672,82.6967,-54.64,-13.7893

lats: 18.3262,15.9548,59.6559,64.5671,18.3262

Then I want to plot the corners in a basemap. But my code doesnot make an accurate boundary. The accurate boundary should be curved and not straight line on the top and bottom.

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

x_big = [-13.7893,39.6672,82.6967,-54.64,-13.7893]
y_big = [18.3262,15.9548,59.6559,64.5671,18.3262]

fig=plt.Figure()
ax = fig.add_subplot(1, 1, 1)
map = Basemap(projection='cyl', resolution = 'i', llcrnrlon=-60, llcrnrlat=5,urcrnrlon=90, urcrnrlat=70)
map.drawcoastlines()
map.drawcountries()
map.bluemarble()
map.plot(x_big, y_big, color='r', lw=5)
map.drawparallels(np.arange(5.,75.,15.),labels=[1,0,0,0])
map.drawmeridians(np.arange(-60.,90.,30.),labels=[0,0,0,1])
plt.show()

When i run this, it generates a map with the right corners, but somehow the lines joining the corners are straight lines which are not accurate. It should be something like in the attached figure:enter image description here

Vinod Kumar
  • 1,383
  • 1
  • 12
  • 26

1 Answers1

1

You need to use .drawgreatcircle() method rather than simple plot(). Here is the working code.

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

# these coordinates for points far apart
x_big = [-13.7893, 39.6672, 82.6967, -54.64, -13.7893]  # lon
y_big = [18.3262, 15.9548, 59.6559, 64.5671, 18.3262]   # lat

fig = plt.Figure()
ax = fig.add_subplot(1, 1, 1)
map = Basemap(projection='cyl', resolution = 'i', llcrnrlon=-60, \
              llcrnrlat=5, urcrnrlon=90, urcrnrlat=82)
map.drawcoastlines()
map.drawcountries()
map.bluemarble()
map.plot(x_big, y_big, color='red', lw=1)

# plot line of great circles
map.drawgreatcircle(x_big[0], y_big[0], x_big[1], y_big[1], del_s=500, lw=2, color="y")
map.drawgreatcircle(x_big[1], y_big[1], x_big[2], y_big[2], del_s=500, lw=2, color="y")
map.drawgreatcircle(x_big[2], y_big[2], x_big[3], y_big[3], del_s=500, lw=2, color="y")
map.drawgreatcircle(x_big[3], y_big[3], x_big[0], y_big[0], del_s=500, lw=2, color="y")

map.drawparallels(np.arange(5., 75., 15.), labels=[1,0,0,0])
map.drawmeridians(np.arange(-60., 90., 30.), labels=[0,0,0,1])
plt.show()

Resulting plot:

enter image description here

swatchai
  • 17,400
  • 3
  • 39
  • 58
  • It is unlikely that the boundaries of the domain follow great circles. I am guessing they are straight lines in the rotated CS in which case the "horizontal" ones would be certainly not great circle segments (the "vertical" ones would, though). But the question is unclear. – Stop harming Monica Apr 28 '18 at 16:32
  • @Goyo When the question is unclear (your words), lines connecting a series of points on the earth should be great-circle arcs as the first guess. – swatchai Apr 28 '18 at 17:22