underworldcode / UWGeodynamics

Underworld Geodynamics
Other
81 stars 32 forks source link

Extract a profile from 3D model #133

Closed HanyMKhalil closed 5 years ago

HanyMKhalil commented 5 years ago

Dear Romain,

I am trying to extract a profile to plot the temperature with depth from my 3D model, but it always work with 2D models only. in 3D it says too many values to unpack. I tried that code:

if GEO.uw.nProcs() == 1:

import matplotlib.pyplot as plt

moho_average_temperature = Model.temperature.evaluate(moho_tracers.swarm).mean()

print("Average Temperature at Moho: {0:5.0f}".format(moho_average_temperature))

distances, temperature = GEO.extract_profile(Model.temperature, line = [(0.* u.kilometer, 0.*u.kilometer, Model.top), (0.* u.kilometer, 0.* u.kilometer, Model.bottom)])

Fig, (ax1, ax2) = plt.subplots(1,2,figsize=(15,7))
ax1.plot(GEO.Dimensionalize(temperature, u.degK), GEO.Dimensionalize(distances, u.kilometer))
ax1.set_xlabel("Temperature in Kelvin")
ax1.set_ylabel("Depth in kms")
ax1.set_ylim(100, 0)
ax1.set_title("Temperature profile")

any suggestions, I guess it does not recognise the z-axis?