The smells from the food stalls, spice shops, a gazillion cats and the horses and scooters are supremely contradictory. Half farmyard, half inner-city traffic stop.

No analogy is ever perfect, but if you want to understand the challenges of negotiating a global deal to secure a safer climate, then the full frontal sensory attack of the medina feels like as appropriate a comparison as any other.

Few transactions are straightforward in the medina and, just like the global United Nations climate talks here in Morocco, there is always a time to barter.

As the talks draw to a close, let’s have a walk through the medina that is the United Nations Framework Convention on Climate Change.

Last year in Paris, almost 200 countries agreed a deal to limit global warming to “well below 2C” while aiming for a safer guardrail of 1.5C.

This, the deal said, would mean that global emissions of greenhouse gases would need to be net neutral in the second of this century.

In the lead up to Paris, each country submitted a climate plan — called a Nationally Determined Contribution (NDC) — to stay below the warming target.

But the problem is that when analysts add these plans together, they show that rather than meeting the “well below 2C” goal, they instead shoot far passed.

The respected group of analysts at Climate Action Tracker, which also monitors the NDCs, says the current pledges will deliver about 2.8C of global warming.

So as part of the Paris deal, countries agreed to revise their plans every five years. Every NDC must improve on the one before. No backsliding allowed.

This is what some call the “ratchet mechanism” and many see it as the saving grace of the new deal struck in Paris.

The first turn of the ratchet comes in 2020, when nations will have to submit their new climate plans.

Then in 2023 there’ll be a “global stocktake” to track progress, before another turn of the ratchet in 2028, and so on.

Dr Joeri Rogelj, of Austria’s International Institute for Applied Systems Analysis, is at the Marrakech talks. He tracks global emissions closely and his work helps inform the United Nations projections.

“The INDCs are not in line with limiting global warming to below 2C and definitely not in line with 1.5C,” he says.

Because countries and economies can’t get their emissions down to zero overnight, Rogelj looks at the “pathways” that economies could take.

He says if countries don’t raise their ambition, then by the year 2030 the world’s annual carbon footprint will be between 15 and 17 billion tonnes too high to make the 1.5C target (take off three billion tonnes for the 2C target). The world currently emits about 32 billion tonnes.

But despite this gap being a key issue, it was not a focus of the Marrakech talks.

Instead, one focus in Marrakech was to clarify all the rules related to NDCs so that each country could be confident that others were being transparent about their actions.

But in Marrakech, countries still sent out strong political signals about raising ambition while getting on with the job of cutting emissions.

A group of 47 countries most vulnerable to the impacts of climate change released a statement pledging that before 2050, they would get all their energy from renewable sources.

A new coalition of countries, including Australia, the UK and US, was announced with an aim to help developing nations deliver on their climate plans.

Late into the second week, all countries agreed to the “Marrakech Action Proclamation” that called for “urgently raising ambition and strengthening cooperation amongst ourselves to close the gap between current emissions trajectories and the pathway needed to meet the long-term temperature goals of the Paris Agreement.”

The medina-style bartering over just how ambitious countries are prepared to be on cutting emissions will go on, with the next major negotiations on this taking place in 2018.

“The gap is still large, but I didn’t expect anything else from Marrakech,” says Rogelj.

“Probably it is a bargaining game, yes. That’s what these diplomatic negotiations are about. To find a way forward that’s acceptable to all the parties.”