Earth's CO2 level is increasing. Julia code to plot it yourself

URL: Carbon dioxide levels in the atmosphere are surging "faster than ever" to beyond anything humans ever experienced, officials say - CBS News

Here is Julia code to plot your own CO2 charts

using CSV, Plots, Downloads
# using MovingAverage 
using EasyFit

println("Program carbon.jl")

# mainurl: https://gml.noaa.gov/ccgg/trends/data.html
url = "https://gml.noaa.gov/webdata/ccgg/trends/co2/co2_mm_mlo.csv"

f = CSV.File(Downloads.download(url),header=0;skipto=42);

yeararr     = collect(Float64,f.Column3)
co2arr      = collect(Float64,f.Column4)
# normco2arr  = f.Column5

# Plot defaults
default(size=(800,600),linewidth=2.0)

plot(yeararr,co2arr,title="Historical CO2",
    legend=false) |> display
#co2MAarr = moving_average(co2arr,12)

# Define our EasyFit.moveavg function
easymovingavg(arr,n)=(EasyFit.movavg(arr,n)).x

co2MAarr2 = easymovingavg(co2arr,12)
plot(yeararr,co2MAarr2,title="Annual Moving Average of CO2",
    legend=false)
#plot!(yeararr,co2MAarr2) |> display
logco2MAarr = map(x->log(10,x),co2MAarr2)
plot(yeararr,logco2MAarr,title="Log10 of Annual Moving Average of CO2",
    legend=false) |> display

plot(yeararr,co2arr)
plot!(yeararr,co2MAarr2,title="Annual CO2",
    legend=false) |> display

# The 11th element of yeararr is the start of year 1959
# June of 1959 is (11+5)th element
# the average co2 value of 1959 is co2MAarr[(11+5)]

# Create array for average yearly co2 concentration
yearly1959co2arr = Float64[]
totalnumofyears = div((length(yeararr)-(11-1)),12)
let k  # runs faster in local scope
    for k = 0:(totalnumofyears - 1)
        push!(yearly1959co2arr,co2MAarr2[(11+5)+(k*12)])
    end
end

# Create array for yearly increment of co2
yearlyco2inc = similar(yearly1959co2arr)
let k # runs faster in local scope
    for k = 1:length(yearlyco2inc)
        if k == 1
            yearlyco2inc[k] = 0.0
        else
            yearlyco2inc[k] = yearly1959co2arr[k] - yearly1959co2arr[k-1]
        end
    end
end
plot(1959:(1959+(totalnumofyears-1)),yearlyco2inc,
    title="Annual increment of CO2",legend=false) |> display

yearly1960co2incarr = yearlyco2inc[2:end]

fiveyearincarr = Float64[]
let k
    for k = 0:(div(length(yearly1960co2incarr),5)-1)
        push!(fiveyearincarr,+(yearly1960co2incarr[(1+k*5):(5+k*5)]...))
    end
end
bar(0:(div(length(yearly1960co2incarr),5)-1),fiveyearincarr,
    yrange=(0.0,max(fiveyearincarr...) * 1.1),legend=false,
    title="Five years CO2 increment") |> display
3 Likes

Thanks for sharing!

The CO2 levels are rising, and extreme weather events are becoming more and more frequent: In Germany we already had the second large flood this year, two dikes broke and four people died. But in poor contries who contributed least to the emmissions these extreme weather events cause a lot more suffering.

In Kenya 267 people died due to floods and thousands lost their homes. There are now more than 281 000 displaced people. I created a fundraiser to support a group of the people who lost their homes: Fundraiser by Uwe Fechner : Flood in Kenya - Emergency relief

Please, support!

4 Likes

It seems that scientists using high-resolution satellite images found that fires in sub-Saharan Africa were responsible for emissions accounting for around 15% of global CO2 emissions from the burning of fossil fuels. They concluded that small fires are of crucial importance in characterizing the most important disruptive agent on a global scale.

1 Like

Thanks for sharing! A colleague of mine commented:

Fire is an integral part of land management in many areas. Known as shifting cultivation. It’s a way to maintain soil fertility. As long as total area of land under this regime does not increase, this is essentially a net-zero emissions practice on time scales of 5-10 years. Relevant for carbon budgeting, but not relevant as a major driver of climate change

1 Like

This is probably a bad assumption, because as the sub-Saharan population increases significantly, the need for land also increases, as does deforestation.

1 Like

Cool GMT figures.

In my experience over the years with ashes from my fireplace, this is a myth.

BTW, for many hears that we have that example (the keeling curve) in our GMT gallery

The GMT.jl however had some issues with it that I just fixed (still in master only) and now we can also do

using GMT

D = gmtread(https://gml.noaa.gov/webdata/ccgg/trends/co2/co2_mm_mlo.txt, i="2,3");
model = trend1d(D, output=:xmr, model="p2,f1+o1958+l1");
plot(D, ms=0.05, fill=:red)
plot!(model, pen=(0.25,:blue))
text!(mat2ds("m@-5@-(t) = a + b@~\\327@~t + c@~\\327@~t@+2@+ + d@~\\327@~cos(2@~p@~t) + e@~\\327@~sin(2@~p@~t)"),
      font=12, region_justify=:TL, offset=(away=true, shift=0.25), fill=:lightyellow, show=1)

1 Like

Reply to your reply from a friend of me who is prof in Amsterdam:

It’s a matter of perspective. These fire systems are very well adapted to local conditions and replacing them with anything else tends to lead to desertification, erosion, and negative livelihood outcomes for most. Obviously as more people rely on this system, it intensifies and/or expands. But that’s not a problem of shifting cultivation specifically. having worked in these landscapes, I find that the real damage is done by the monocrop plantations that encroach on them. And that’s something we can actually do something meaningful about, while population increase is not and should not be.

And yet xkcd: Greenhouse Effect …

4 Likes

And lest we be too fearful… Cold kills more people each year than heat.

1 Like

It is more complicated than that: Which Kills More People: Extreme Heat or Extreme Cold? | Weather Underground

“However, this study did not control for the seasonal cycle in death rates; deaths are always higher in winter, due to influenza and other non-weather-related factors.”

Or read the last message from the UN Secretaries General on this topic: Leaders ‘Must Step Up and Act — Now’ to Address Climate Change, Says Secretary-General, in Message on Launch of Global Report | Meetings Coverage and Press Releases

for some reason, I lost connection to government website

PING gml.noaa.gov (140.172.200.41): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
^C
--- gml.noaa.gov ping statistics ---
5 packets transmitted, 0 packets received, 100.0% packet loss

$ date -u
Sun  9 Jun 2024 05:59:21 UTC

But it is because it is cold in winter - what else? Or should it be the positions of the stars on the sky, which facilitate the virus spread?

I think that the precise reason is not known at this point. The fact that people breath the same air in closed room is indeed (indirectly) linked to the temperature.

1 Like

Yes, in most case the cold action is indirect: Hypothermia as the recorded cause of death is probably a rare case. Just there are lot of ways how cold weather may act, be it having to stay at home, be it accidents on ice. Getting a meaningful statistics here is difficult, especially if the topic is highly political (and it is).

Sometimes 50 degree Celsius (122 °Fahrenheit) in India and Pakistan

How do people cope with this heat?

It feels like living in hell, says a young Pakistani. The sun is burning holes in his back, says an Indian supplier. Scenes from a world that is too hot.

Temperatures of more than 40 °C (104 °F) are not unusual in South Asia at this time of year. Recently, however, heat records have been broken at several locations in the region, with temperatures reaching over 50 °C (122 °F).

During this heat, India recently held its parliamentary elections: Almost one billion people were called to the polls on various days. There were repeated reports of heatstrokes, some of which were fatal: In the state of Uttar Pradesh, 33 election workers died on a single day, local media reported, citing official figures.

The authorities called on people to avoid the heat outside as much as possible. But food delivery man Vijay Kumar Singh has no choice. He rides his motorcycle around the Delhi metropolitan region every day in the dry heat. Sometimes the seat heats up so much that he has to put a cloth on it and wrap his hands with scraps of cloth, he says: “When I wait outside doors in the blazing sun, I can feel it burning holes in my back.”

Even at night, the temperature never drops below 30 °C (86 °F) these days. And in his room, which he shares with two other men, there is only one window and a fan. “If the power goes out and the lights go out, we always go outside - then at least there’s some wind. A hot wind.”

In addition, people in some places are complaining about a lack of water: the water level in dozens of reservoirs has fallen to a fraction of their storage capacity, the Indian television station NDTV recently reported, citing the country’s central water authority.

“This summer it feels like we are living in hell”

Authorities in India and neighboring Pakistan therefore took measures: Schools were temporarily closed, zoos were told to hose down animals with cool water. In the western Indian city of Ahmedabad, authorities had thousands of roofs in poorer districts painted with paint that reflects the sun’s rays several years ago, according to local media. This has led to a certain reduction in temperature.

In the southern Pakistani city of Dadu, resident Meer Shahdad Laghari reports that authorities are distributing fruit juices and cold water to passers-by due to the current heatwave. "We have experienced such extreme heat before, but never for so long.
This summer it feels like we’re living in hell,” complains the 29-year-old. He fears that he will soon have to leave his city if it is regularly hit by such extreme temperatures in the future.

Translated from: Indien und Pakistan: Wie halten Menschen Temperaturen von 50 Grad aus? - DER SPIEGEL

2 Likes

I have put in the code for the relative annual increase in CO2.

# Create array for yearly increment of co2
yearlyco2pctinc = similar(yearly1959co2arr)
let k # runs faster in local scope
    for k = 1:length(yearlyco2pctinc)
        if k == 1
            yearlyco2pctinc[k] = 1.0
        else
            yearlyco2pctinc[k] = yearly1959co2arr[k] / yearly1959co2arr[k-1]
        end
    end
end
plot(1959:(1959+(totalnumofyears-1)),yearlyco2pctinc,
    title="Annual (relative) increment of CO2",legend=false) |> display
histogram(yearlyco2pctinc, title="Annual (relative) increment of CO2",
label="Annual Gain", 
bins=range(1.0, 1.01, length=11), yrange=(0,310),
xticks=1.0005:0.001:1.0095, yticks=0:25:300,
normalize=:pdf, color=:gray) |> display

With the resulting two plots

It shows that the most common increase is 0.45% (1.0045) annually

It’s lower humidity. Keep your RH at 50% in your home in the winter (as long as you don’t get condensation on the windows).

This topic was automatically closed after 3 days. New replies are no longer allowed.