Fortunate Global Greening

Update: See new information.

NASA offers a data product called a Vegetation Index. This can be used to track how green the Earth is.

February 2000, [Source]

Although many are familiar with recent global greening, I prefer to always check the source data. And so I downloaded all of their available 16-day-increment data from 2000 to 2021. Here’s my result:

0.0936 --> 0.1029 is +9.94%

10% global greening in 20 years! We are incredibly fortunate!

I just wish everyone felt that way. But you know not everyone does. To the extent that humans enhance global greening is precisely what social parasites want to tax and regulate. No good deed goes unpunished.

Anyway, Enjoy 🙂 -Zoe

P. S. The Earth is ~29% land. A Veg Index of ~0.29 would mean all covered land is heavy vegetation.

Update: See new information.

# Zoe Phin, 2021/02/16
# File: veg.sh
# Run: source veg.sh; sets; download; index; plot

sets() {
    for y in {2000..2021}; do
        wget -qO- "https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MOD_NDVI_16&year=$y" 
    done | awk -F\' '/"viewDataset/{print $4" "$2}' > sets.csv 
}

download() {
    rm -f wget.log [0-9]*.csv
    awk '{print "wget -a wget.log -O "$1".csv \"https://neo.sci.gsfc.nasa.gov/servlet/RenderData?si="$2"&cs=rgb&format=CSV&width=360&height=180\""}' sets.csv > sets.sh
    bash sets.sh
    rm -f 201[789]-12-31.csv
}

area() {
    seq -89.5 1 89.5 | awk '{
        a=6378.137; e=1-6356.752^2/a^2; r=atan2(0,-1)/180
        printf "%.9f\n",(a*r)^2*(1-e)*cos(r*$1)/(1-e*sin(r*$1)^2)^2/1416867.06
    }' > .area
}

avg() {
    awk -F, '{
        for (i=2;i<=NF;i++) { 
            if ($i~/999/) $i=0
            S+=$i; N+=1
        }
        printf "%s %.4f\n", $1, S/N
    }' | awk '{ 
        S+=$1*$2 
    } END { 
        printf "%0.4f\n", S
    }'
}

yoy() {
    cat .csv | cut -c12- | tr '\n' ' ' | awk -vp=$1 '{
        for (i=0;i<p/2;i++) print ""
        for (i=p/2;i<=NF-p/2;i++) { s=0
            for (j=i-p/2; j<=i+p/2; j++)
                s+=$j/(p+1)
            printf "%.4f\n", s
        }
    }' > .yoy
}

index() { area
    for f in $(ls -1 2*.csv); do
        echo -n "${f/.csv/} "
        paste -d, .area $f | avg
    done > .csv
}

plot() { 
    yoy 22; paste -d ' ' .csv .yoy > plot.csv
    sed -n '12p;$p' .yoy | tr '\n' ' ' | awk '{printf "%s --> %s, is %+0.2f%\n", $1, $2, ($2/$1-1)*100 }'
    echo "
        set term png size 740,620
        set key outside top center horizontal
        set timefmt '%Y-%m-%d'
        set xdata time
        set xtics format '%Y'
        set ytics format '%4.2f'
        set ytics 0.01
        set mxtics 2
        set mytics 5
        set xrange ['2000-01-01':'2020-12-31']
        set grid xtics mxtics ytics
        plot 'plot.csv' u 1:2 t 'Vegetation Index ' w lines lw 2 lc rgb '#00CC00',\
                     '' u 1:3 t '1-Year Moving Avg' w lines lw 3 lc rgb '#005500'		
    "| gnuplot > veg.png 
}

Published by Zoe Phin

https://phzoe.com

65 thoughts on “Fortunate Global Greening

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: