avatarRP

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

3392

Abstract

   <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*mbPNVywqfuaaJEE0)"></div>
          </div>
        </div>
      </a>
    </div><p id="e117">Here we’ve put together a list of some exciting and unique ideas of how to deal with anxiety when your boyfriend or husband goes out.</p><h1 id="8982">1. Communicate With Your Beloved</h1><figure id="073d"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*h_1yJ7rp8mm66RHp"><figcaption>Photo by <a href="https://unsplash.com/@henrihere?utm_source=medium&amp;utm_medium=referral">Henri Pham</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p id="b290" type="7">Falling in love is easy, but the fear of losing someone is more common in females or girls than in males or boys.</p><p id="249e">As you get into a relationship, the things will not always remain the same between both of you. Sometimes, it will bring you lots of happiness, and sometimes you’ll feel depressed and hopeless.</p><div id="b6ba" class="link-block">
      <a href="https://readmedium.com/why-i-once-decided-to-end-my-life-dcaac8108878">
        <div>
          <div>
            <h2>Why I Once Decided To End My Life?</h2>
            <div><h3>My life is full of problems, and I sometimes think of ending my life…</h3></div>
            <div><p>medium.com</p></div>
          </div>
          <div>
            <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*2WNkqY43O_jA1dyz)"></div>
          </div>
        </div>
      </a>
    </div><p id="d9f3">The best and most important way to deal with relationship anxiety is calling your boyfriend or husband once a while. If they’re out for some time, you should keep calling them every hour to remind them how much you love them.</p><p id="e1e1">There’s no need to get stressed if your boyfriend or husband remains out for several hours. Maybe, they’ve some urgent works to do. You just have to be polite and speak nicely, make them realize that you care for them and want them to come back as soon as possible.</p><h1 id="4430">2. Exercise Or Brisk Walk</h1><figure id="5179"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*gCB8QQvSvUyoa5wD"><figcaption>Photo by <a href="https://unsplash.com/@liujiao?utm_source=medium&amp;utm_medium=referral">Liu Jiao</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p id="2998">This is not a joke; anxiety is a serious mental condition and that means you’ll have to manage it in any way. Exercise is indeed a good way to control the way you feel.</p><div id="548d" class="link-block">
      <a href="https://readmedium.com/you-dont-need-exercises-to-be-healthy-and-fit-here-s-why-50c6b32a82c7">
        <div>
          <div>
            <h2>You Don’t Need Exercises To Be Healthy And Fit — Here’s Why</h2>
            <div><h3>If you want to be healthy, you don’t need treadmills or weight machines. Let’s check out why…</h3></div>
            <div><p>medium.com</p></div>
          </div>
          <div>
            <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*KFpMZA1MPQMIOJtI)"></div>
          </div>

Options

     </div>
      </a>
    </div><p id="52b5" type="7">It has now been proved that brisk walk or exercise is a powerful and comprehensive way to control anxiety symptoms.</p><h1 id="ecb0">3. Start Over</h1><figure id="ebf7"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*10VfnKgugxKjc8BW"><figcaption>Photo by <a href="https://unsplash.com/@lgnwvr?utm_source=medium&amp;utm_medium=referral">LOGAN WEAVER</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p id="fa7a">If the trust has gone, you should talk to your partner instantly and start over. Trust and respect are the foundations of a relationship, and if things aren’t going as planned, you’ll have to redo everything needed to strengthen this relationship.</p><div id="d670" class="link-block">
      <a href="https://readmedium.com/not-falling-in-love-is-itself-a-disease-8e7a625a3f9e">
        <div>
          <div>
            <h2>Not Falling In Love Is Itself A Disease</h2>
            <div><h3>If you are afraid of falling in love or getting close to someone, you are probably suffering from a severe…</h3></div>
            <div><p>medium.com</p></div>
          </div>
          <div>
            <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*GB2rd4DdJpvTfbX4)"></div>
          </div>
        </div>
      </a>
    </div><p id="9ec6" type="7">It’ll take you weeks or even months to get back to a normal life. At the same time, you should not fall back into old habits.</p><h1 id="033a">4. Stay Mentally Busy</h1><figure id="962e"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*p0dj3T0srlmx57bF"><figcaption>Photo by <a href="https://unsplash.com/@mannydream?utm_source=medium&amp;utm_medium=referral">Manny Moreno</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p id="7b97">Being busy will be difficult if your partner is out for many hours. However, you need to do so in order to improve your mood. You can begin reading a book, watch television or cook some food for your beloved.</p><p id="546d" type="7">You should do all the things that can keep your mind off your partner for some time. Gardening is also a good idea, or else, you can play some video games.</p><div id="adc6" class="link-block">
      <a href="https://readmedium.com/the-heart-is-made-to-be-loved-9a747000d9ae">
        <div>
          <div>
            <h2>The Heart Is Made To Be Loved</h2>
            <div><h3>If you think you don’t need anyone to live happily, you are totally wrong…</h3></div>
            <div><p>medium.com</p></div>
          </div>
          <div>
            <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/0*4JJQuCU2xaRgQoYS)"></div>
          </div>
        </div>
      </a>
    </div><p id="abfb">In the end, we’d like to say that you should give them some freedom. Maybe, your partner wants to focus on his career or some other things, so you need to understand their feelings and happily allow them to stay away from you for as much time as they want.</p><h2 id="81cd">What do you do when your boyfriend or husband doesn’t respond to your calls?</h2></article></body>
Northern Africa’s matplotlib hight resolution render

Mapping Elevation Data in Python’s Matplotlib

Learn how to add beautiful 3D terrain to your plots using accurate earth elevation data with this step-by-step guide.

STEP 1 : Get the elevation data

In order to plot the 3D terrain — commonly refered to as “elevation” in the geographers’ field — we first need to acquire this data from a trusted source. Many websites can give you such information, with various degrees of accuracy, and among them is the United State’s Geological Survey’s Earth Explorer, which will perfectly match our needs in this case.

USGS’s Earth Explorer Website

In order to find the data of interest, go to the Data Sets section in the left hand-side menu, and select the GTOPO30 option. On a side note, this elevation map is not the most precise, and covers the globe using large tiles, which do not provide good data for very small scales. However, they are largely sufficient for most usecases, as we will resize and crop the image data as we like.

Dataset selection

Next, find the elevation data picture that encompasses the land you would like to map. Note that the tiles are named after the latitude and longitude they cover. For this exemple, we will use the North-West African Tile (GT30W020N40) as to get both mountains and oceans to make this look interesting.

North-West Africa Tile, GT30W020N40

STEP 2 : Get the python script ready

We first import all the necessary packages : PIL.Image to load and resize/crop the picture, Numpy to deal with the picture’s data and a subset of matplotlib’s libraries to plot nicely the result.

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap, ListedColormap
from matplotlib import cm
from PIL import Image

Then we’ll add some lines to get a custom color map from the “terrain” default map, that will differentiate between land (elevation above 1m) and water (yes, you guessed it, below 1m). In a few words, this piece of code firstly loads the “terrain” color map (you can find more matplotlib color maps here), samples it from 20% of the spectrum to the end (to cut off the blue color and save it for the ocean), and finally adds the blue RGB values at the beginning of the spectrum, before declaring it as a new usable color map.

terrain = cm.get_cmap("terrain").resampled(256)
newcolors = terrain(np.linspace(0.2, 1, 256))
newcolors[:1, :] = np.array([39/256, 30/256, 100/256, 1])
newcmp = ListedColormap(newcolors)

STEP 3: Make the plotting function

In order to be able to plot from any data picture, we’ll define a function map. In the first lines of the function, we take the image from the file path input (always make sure the path has the backslashes “\” escaped as “\\”) and we crop it to one interesting part (note that 1° of latitude or longitude is represented by 120 pixels in the picture, which is why i use multiples of 120).

Then, we use some numpy magic to define the plotting grid, using our reduction parameter : set to 1, you get full details (might crash or slow down your computer noticeably for big areas) — set to 10, you divide by 10 the number of sample points in your picture, and so on for bigger values. One may also decrease the detail level of the plot by increasing the rstride and cstride values in the plot_surface function. The exageration input is used to increase the height of the surface’s features for a more dramatic effect.

def map(path,reduction=10,exageration=4):
    img = Image.open(path) #MAKE SURE THE "\" ARE ESCAPED AS "\\" IN THE PATH !
    img = img.crop((10*120,5*120,15*120,10*120)) #CROP TO YOUR DESIRED SPOT HERE !
    x,y = img.size
    img = np.flipud(exageration*np.asarray(img.resize((int(x/reduction),int(y/reduction))),dtype=int))
    X,Y = np.meshgrid(np.linspace(0,int(x/reduction),int(x/reduction)),np.linspace(0,int(y/reduction),int(y/reduction)))
    ax = plt.figure().add_subplot(projection='3d')
    ax.set_zlim([0,5000])
    ax.plot_surface(X,Y,img,rstride=1,cstride=1,alpha=1,cmap=newcmp,antialiased=False)
    plt.show()

STEP 4: Enjoy

Once our function is ready, we can now get a clean elevation plot in two lines of code :

file_path = "C:\\Users\\Username\\Pictures\\gt30w020n40.jpg"

map(file_path,reduction=15,exageration=2)

Here are a few results you can get from this setup, varying the inputs :

1. Varying the localisation (cropping)

Different croping values, exageration=4 & reduction=10

2. Varying the reduction

different reduction values (100;30;10), exageration=4

3. Varying the exageration

different exageration values (1;4;10)

Thank you for reading ! Here’s the full code in case you need a quick copy/paste :

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap, ListedColormap
from matplotlib import cm
from PIL import Image

terrain = cm.get_cmap("terrain").resampled(256)
newcolors = terrain(np.linspace(0.2, 1, 256))
newcolors[:1, :] = np.array([39/256, 30/256, 100/256, 1])
newcmp = ListedColormap(newcolors)

def map(path,reduction=10,exageration=4):
    img = Image.open(path) #MAKE SURE THE "\" ARE ESCAPED AS "\\" IN THE PATH !
    img = img.crop((10*120,5*120,15*120,10*120)) #CROP TO YOUR DESIRED SPOT HERE !
    x,y = img.size
    img = np.flipud(exageration*np.asarray(img.resize((int(x/reduction),int(y/reduction))),dtype=int))
    X,Y = np.meshgrid(np.linspace(0,int(x/reduction),int(x/reduction)),np.linspace(0,int(y/reduction),int(y/reduction)))
    ax = plt.figure().add_subplot(projection='3d')
    ax.set_zlim([0,5000])
    ax.plot_surface(X, Y,img,rstride=1, cstride=1,alpha=1,cmap=newcmp,antialiased=False)
    plt.show()

file_path = "C:\\Users\\Username\\Pictures\\gt30w020n40.jpg"

map(file_path,reduction=15,exageration=2)

In Plain English

Thank you for being a part of our community! Before you go:

Python
Matplotlib
Maps
Geography
3d
Recommended from ReadMedium