basemap day and night

Arto Oksanen wrote:

Thanks for your prompt reply. I should have given a more detailed explanation. I do know the solar position and then the latitude and longitude of the point on globe where the Sun is on the zenith. And as the sun illuminates always half of the globe, I just need to draw a "dark half globe" over the normal globe. Is this possible? That should be a lot simpler than drawing continents etc. :slight_smile:

arto

Arto: Here's something - is this what you're looking for? It computes the day-night terminator, then shades one side of the terminator gray on a map.

-Jeff

P.S. I've cc-ed the matplotlib users list in case anyone else has ideas.

terminator.py (1.5 KB)

terminator.png

···

2009/8/24 Jeff Whitaker <jeffrey.s.whitaker@…259… <mailto:jeffrey.s.whitaker@…259…>>

    Arto Oksanen wrote:

        Hello from Finland!

        I am writing an utility for quickly seeing where astronomical
        events (like a GRB) are visible on Earth. I have installed
        Basemap and it generates very nice Earth views, but I still need
        to somehow display the day and night on the globe. Any sample
        code somewhere or some pointers how to do this?

        I am looking for something like this:
        http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif
        <http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif>
        <http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif
        <http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif>>

        TIA!

        arto

        – Arto Oksanen
        arto.oksanen@…2749… <mailto:arto.oksanen@…2749…>
        <mailto:arto.oksanen@…2749…
        <mailto:arto.oksanen@…2749…>>
        Muurame, Finland

    Arto: This might help:

    http://en.wikipedia.org/wiki/Sunrise_equation

    -Jeff


Arto Oksanen
arto.oksanen@…2749… <mailto:arto.oksanen@…2749…>
Muurame, Finland

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg

Thanks Jeff!

That is just a perfect solution!!

arto

2009/8/24 Jeff Whitaker <jswhit@…146…>

···

Arto Oksanen wrote:

Thanks for your prompt reply. I should have given a more detailed explanation. I do know the solar position and then the latitude and longitude of the point on globe where the Sun is on the zenith. And as the sun illuminates always half of the globe, I just need to draw a “dark half globe” over the normal globe. Is this possible? That should be a lot simpler than drawing continents etc. :slight_smile:

arto

Arto: Here’s something - is this what you’re looking for? It computes the day-night terminator, then shades one side of the terminator gray on a map.

-Jeff

P.S. I’ve cc-ed the matplotlib users list in case anyone else has ideas.

2009/8/24 Jeff Whitaker <jeffrey.s.whitaker@…259… mailto:jeffrey.s.whitaker@...878....259...>

Arto Oksanen wrote:



    Hello from Finland!



    I am writing an utility for quickly seeing where astronomical

    events (like a GRB) are visible on Earth. I have installed

    Basemap and it generates very nice Earth views, but I still need

    to somehow display the day and night on the globe. Any sample

    code somewhere or some pointers how to do this?



    I am looking for something like this:

    [http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif](http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif)


    <[http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif](http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif)>


    <[http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif](http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif)


    <[http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif](http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif)>>




    TIA!



    arto



    --        Arto Oksanen

    arto.oksanen@...2749... <mailto:arto.oksanen@...2749...>

    <mailto:arto.oksanen@...2749...

    <mailto:arto.oksanen@...2749...>>

    Muurame, Finland



Arto:  This might help:



[http://en.wikipedia.org/wiki/Sunrise_equation](http://en.wikipedia.org/wiki/Sunrise_equation)



-Jeff

Arto Oksanen

arto.oksanen@…120…2749… mailto:arto.oksanen@...2749...

Muurame, Finland

Jeffrey S. Whitaker Phone : (303)497-6313

Meteorologist FAX : (303)497-6449

NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@…259…

325 Broadway Office : Skaggs Research Cntr 1D-113

Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg


Arto Oksanen
arto.oksanen@…2749…
Muurame, Finland

Arto Oksanen wrote:

Thanks Jeff!

That is just a perfect solution!!

arto

Arto: I've cleaned up that example and added it to svn as examples/daynight.py.

-Jeff

···

2009/8/24 Jeff Whitaker <jswhit@…146… <mailto:jswhit@…146…>>

    Arto Oksanen wrote:

        Thanks for your prompt reply. I should have given a more
        detailed explanation. I do know the solar position and then
        the latitude and longitude of the point on globe where the Sun
        is on the zenith. And as the sun illuminates always half of
        the globe, I just need to draw a "dark half globe" over the
        normal globe. Is this possible? That should be a lot simpler
        than drawing continents etc. :slight_smile:

        arto

    Arto: Here's something - is this what you're looking for? It
    computes the day-night terminator, then shades one side of the
    terminator gray on a map.

    -Jeff

    P.S. I've cc-ed the matplotlib users list in case anyone else has
    ideas.

        2009/8/24 Jeff Whitaker <jeffrey.s.whitaker@…259…
        <mailto:jeffrey.s.whitaker@…259…>
        <mailto:jeffrey.s.whitaker@…259…
        <mailto:jeffrey.s.whitaker@…259…>>>

           Arto Oksanen wrote:

               Hello from Finland!

               I am writing an utility for quickly seeing where
        astronomical
               events (like a GRB) are visible on Earth. I have installed
               Basemap and it generates very nice Earth views, but I
        still need
               to somehow display the day and night on the globe. Any
        sample
               code somewhere or some pointers how to do this?

               I am looking for something like this:
                      http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif
        <http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif>
                      <http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif
        <http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif>>
                      <http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif
        <http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif>
                      <http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif
        <http://www.fourmilab.ch/cgi-bin/Earth?imgsize=320&opt=-l&lat=57.1667&ns=North&lon=49.125&ew=West&alt=372461&img=learth.evif>>>

               TIA!

               arto

               – Arto Oksanen
               arto.oksanen@…2749…
        <mailto:arto.oksanen@…2749…>
        <mailto:arto.oksanen@…2749…
        <mailto:arto.oksanen@…2749…>>
               <mailto:arto.oksanen@…2749…
        <mailto:arto.oksanen@…2749…>
               <mailto:arto.oksanen@…2749…
        <mailto:arto.oksanen@…2749…>>>
               Muurame, Finland

           Arto: This might help:

           http://en.wikipedia.org/wiki/Sunrise_equation

           -Jeff

        – Arto Oksanen
        arto.oksanen@…2749… <mailto:arto.oksanen@…2749…>
        <mailto:arto.oksanen@…2749…
        <mailto:arto.oksanen@…2749…>>
        Muurame, Finland

    – Jeffrey S. Whitaker Phone : (303)497-6313
    Meteorologist FAX : (303)497-6449
    NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@…259…
    <mailto:Jeffrey.S.Whitaker@…259…>
    325 Broadway Office : Skaggs Research Cntr 1D-113
    Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg


Arto Oksanen
arto.oksanen@…2749… <mailto:arto.oksanen@…2749…>
Muurame, Finland

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-113
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg