File:Planet that has 90 obliquity temperature through year 1 1 1 1.png

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(1,041 × 487 pixels, file size: 189 KB, MIME type: image/png)

Captions

Captions

Planet that has 90 obliquity - temperatures through year

Summary

[edit]
Description
English: Planet that has 90 obliquity - temperatures through year
Date
Source Own work
Author Merikanto

Python3 source code to make this image

Python3 climlab source code

<syntaxhighlight lang="python">

                                                                        1. 3
    1. seasonal climlab energy balance model
  1. python3/climblab code
  2. 1.11.2023 0000.0004c

import math import numpy as np import matplotlib.pyplot as plt from matplotlib import cm import climlab from climlab import constants as const from climlab.process.diagnostic import DiagnosticProcess from climlab.domain.field import Field, global_mean from scipy.interpolate import griddata from skimage.transform import resize

numyears=30 ##n no function

numlat=18 numlev=6

plotvar=0 ## 1,2,3 lot temp, ice, mean albedo

waterdepth=20

  1. S1=1365.2*1

au1=1.00

Sk=1/math.pow(au1,2) ## relative sun constant to Earth now

S1=1361.5*Sk

  1. ecc=0.0167643,
  2. long_peri=280.32687
  3. obliquity=23.459277

ecc=0 long_peri=0 obliquity=90

  1. co2=280 ##co2 amount ppmv

co2=280

diffu1=0.3 # meridional diffusivity in m**2/s

albedo0=0.28

  1. orbit={'ecc': 0.0167643, 'long_peri': 280.32687, 'obliquity': 23.459277, 'S0':S1}

orbit={'ecc': ecc, 'long_peri': long_peri, 'obliquity': obliquity, 'S0':S1}

class tanalbedo(DiagnosticProcess):

   def __init__(self, **kwargs):
       super(tanalbedo, self).__init__(**kwargs)
       self.add_diagnostic('albedo')
       Ts = self.state['Ts']
       self._compute_fixed()
   def _compute_fixed(self):
       Ts = self.state['Ts']
       try:
           lon, lat = np.meshgrid(self.lon, self.lat)
       except:
           lat = self.lat
       phi = lat
       try:
           albedo=np.zeros(len(phi));
           albedo=0.42-0.20*np.tanh(0.052*(Ts-3))
       except:
           albedo = np.zeros_like(phi)
       dom = next(iter(self.domains.values()))
       self.albedo = Field(albedo, domain=dom)
   def _compute(self):
       self._compute_fixed()
       return {}
  1. creating EBM model
  1. ebm= climlab.EBM(CO2=co2,orbit={'ecc': 0.0167643, 'long_peri': 280.32687, 'obliquity': 23.459277, 'S0':S1})
  2. ebm0= climlab.EBM_seasonal(water_depth=10.0, a0=0.3, num_lat=90, lum_lon=None, num_lev=10,num_lon=None
  3. , orbit=orbit)

ebm0= climlab.EBM_seasonal(water_depth=waterdepth, a0=albedo0, num_lat=numlat, lum_lon=None, num_lev=numlev,num_lon=None , orb=orbit)

ebm=climlab.process_like(ebm0)

  1. ebm.step_forward()
  2. print(ebm.diagnostics)
  1. quit(-1)

surface = ebm.domains['Ts']

  1. define new insolation and SW process

ebm.remove_subprocess('insolation') insolation = climlab.radiation.DailyInsolation(domains=surface, orb = orbit, **ebm.param) insolation.S0=S1

    1. sun = climlab.radiation.DailyInsolation(domains=model.Ts.domain)

ebm.add_subprocess('insolation', insolation)

  1. ebm.step_forward()
  1. print(insolation.diagnostics)
  1. print (insolation.insolation)
  2. print (np.max(insolation.insolation))
    1. print(insolation.S0)
  1. quit(-1)

ebm.remove_subprocess('albedo') alb = climlab.surface.albedo.StepFunctionAlbedo(state=ebm.state, Tf=-10, **ebm.param)

  1. alb = climlab.surface.albedo.StepFunctionAlbedo(state=ebm.state, Tf=-20, **ebm.param)
  2. alb = climlab.surface.albedo.ConstantAlbedo(domains=surface, **ebm.param)
  3. alb = tanalbedo(state=ebm.state, **ebm.param)

ebm.add_subprocess('albedo', alb) ebm.remove_subprocess('SW') SW = climlab.radiation.absorbed_shorwave.SimpleAbsorbedShortwave(insolation=insolation.insolation, state = ebm.state, albedo = alb.albedo, **ebm.param) ebm.add_subprocess('SW', SW) ebm.remove_subprocess('LW') LW = climlab.radiation.aplusbt.AplusBT_CO2(CO2=co2,state=ebm.state, **ebm.param) ebm.add_subprocess('LW', LW)

  1. print(SW.diagnostics)
  1. quit(-1)
  1. ebm.CO2=co2

ebm.remove_subprocess('diffusion') D=diffu1

  1. meridional diffusivity in m**2/s
  2. K = D / ebm.Tatm.domain.heat_capacity * const.a**2

K= D/ 700* const.a**2 diff = climlab.dynamics.MeridionalMoistDiffusion(state=ebm.state, timestep=ebm.timestep) ebm.add_subprocess('diffusion', diff)

  1. print (ebm)

ebm.step_forward()

  1. ebm.diagnostics
  1. ebm.integrate_years(numyears)
  2. ebm.integrate_years(1)

ebm.integrate_converge()

  1. print(ebm.Ts)
  1. plt.plot(ebm.Ts)
  1. plt.show()

num_steps_per_year = int(ebm.time['num_steps_per_year']) mean_year = np.empty(num_steps_per_year) for m in range(num_steps_per_year): ebm.step_forward() mean_year[m] = ebm.global_mean_temperature() Tmean_year = np.mean(mean_year)

print(round(Tmean_year,2))

if(plotvar==0):

       num_steps_per_year = int(ebm.time['num_steps_per_year'])
       Tyear = np.empty((ebm.lat.size, num_steps_per_year))
       for m in range(num_steps_per_year):
           ebm.step_forward()
           Tyear[:,m] = np.squeeze(ebm.Ts)
       Tmin=round(np.min(Tyear),1)
       Tmax=round(np.max(Tyear),1)
       
       #Tmean=round( np.mean(Tyear),1)
       tmeans1=np.mean(Tyear, axis=1)
       #print (ebm.lat)
       latrads1=np.radians(ebm.lat)
       latcoeffs1=np.power(np.cos(latrads1),2)
       tmeans2=tmeans1*latcoeffs1
       Tmean=np.mean(tmeans2)
       #print (np.shape(tmeans1))
       #quit(-1)        
       fig = plt.figure(figsize=(5,5))
       ax = fig.add_subplot(111)
       
       factor = 365. / num_steps_per_year
       cmap1=plt.cm.seismic
       cmap1=plt.cm.winter
       cmap1=plt.cm.coolwarm
       #cmap1=plt.cm.cool_r
       #cmap1=plt.cm.cool
       #cmap1=cmap1.reversed()      
       #levels1=[-80,-70,-60,-50,-40,-30]
       levels2=[-200,-150,-120,-100,-70,-60,-50,-40,-30,-20,-10,0,5,10,15,20,25,30,35,40,45,50,60,70,80,90,100,120,150,300]
       Tyear2 = resize(Tyear, (Tyear.shape[0] *3, Tyear.shape[1]*2),anti_aliasing=True)
       ax.imshow(Tyear, origin="lower", extent=[0,360,-90,90], cmap=cmap1, interpolation="bicubic")
       #cax = ax.contourf(factor * np.arange(num_steps_per_year),
       #              ebm.lat, Tyear[:,:], 
       #              cmap=cmap1, vmin=Tmin, vmax=Tmax, antialiased=False, levels=levels2)
       cs1 = ax.contour(factor * np.arange(num_steps_per_year), ebm.lat,Tyear[:,:],
                     origin="lower", extent=[0,360,-90,90], alpha=0.5, 
                     colors='#00005f', vmin=Tmin, vmax=Tmax, levels=levels2)
       ax.clabel(cs1, cs1.levels, inline=True, fontsize=14)                     
       #cbar1 = plt.colorbar(cax)
       title1='Temperatures degC of planet, if ecc='+str(round(ecc,3))++str(round(long_peri,2))+' and obliquity='+str(round(obliquity,2))+' deg \n if S0= '+ str(round(S1,1)) +' W m-2 , pressure of CO2= '+str(round(co2,2))+' ppm volume'
       title2="\nTemperature deg C:  min "+str(round(Tmin,2))+" max "+str(round(Tmax,2))+" mean "+str(round(Tmean,2))
       #ax.set_suptitle(title1, fontsize=12)
       ax.set_title(title1+title2, fontsize=11)
       ax.tick_params(axis='x', labelsize=12)
       ax.tick_params(axis='y', labelsize=12)
       ax.set_xlabel('Days of year', fontsize=13)
       ax.set_ylabel('Latitude', fontsize=13)
       plt.savefig('1000dpi.svg', dpi=1000)

if(plotvar==1):

       if 'Tf' in ebm.subprocess['albedo'].param.keys():
           Tf = ebm.subprocess['albedo'].param['Tf']
       else:
           print('No ice considered in this model. Can not plot.')
       num_steps_per_year = int(ebm.time['num_steps_per_year'])
       ice_year = np.empty((ebm.lat.size, num_steps_per_year))
       for m in range(num_steps_per_year):
           ebm.step_forward()
           ice_year[:,m] = np.where(np.squeeze(ebm.Ts) <= Tf, 0, 1)
       
       fig = plt.figure(figsize=(5,5))
       ax = fig.add_subplot(111)
       
       factor = 365. / num_steps_per_year
       cax = ax.contourf(factor * np.arange(num_steps_per_year),
                     ebm.lat, ice_year[:,:], 
                     cmap=plt.cm.seismic, vmin=0, vmax=1, levels=2)
       cbar1 = plt.colorbar(cax)
       
       ax.set_title('Ice throughout the year', fontsize=14)
       ax.set_xlabel('Days of year', fontsize=14)
       ax.set_ylabel('Latitude', fontsize=14)

if(plotvar==2):

       fig = plt.figure(figsize=(7.5,5))
       # Temperature plot
       ax2 = fig.add_subplot(111)
       ax2.plot(ebm.lat,ebm.albedo)
       ax2.set_title('Albedo', fontsize=14)
       ax2.set_xlabel('latitude', fontsize=10)
       ax2.set_ylabel(, fontsize=12)
       ax2.set_xticks([-90,-60,-30,0,30,60,90])
       ax2.set_xlim([-90,90])
       ax2.set_ylim([0,1])
       ax2.grid()
   
       plt.show()

plt.suptitle("Planet that has 90 obliquity") plt.title("Temperature deg C") plt.legend() plt.show()

</<syntaxhighlight>

Licensing

[edit]
I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current18:31, 12 November 2023Thumbnail for version as of 18:31, 12 November 20231,041 × 487 (189 KB)Merikanto (talk | contribs)Uploaded own work with UploadWizard

There are no pages that use this file.

Metadata