Changeset 3833 for trunk/LMDZ.PLUTO/util/script_figures/maptemp.py
- Timestamp:
- Jul 7, 2025, 1:39:13 PM (8 hours ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.PLUTO/util/script_figures/maptemp.py
r3823 r3833 1 1 #! /usr/bin/env python 2 import os 2 3 from netCDF4 import Dataset 3 4 from numpy import * … … 11 12 from mpl_toolkits.basemap import Basemap, shiftgrid 12 13 from matplotlib.cm import get_cmap 13 from FV3_utils import * # import name 14 from FV3_utils import * 15 from input import * # import name 16 print("Running "+os.path.basename(__file__)) 14 17 15 18 ############################ … … 26 29 27 30 ### Data 28 # name='../diagfi2015.nc' # read from FV3_util29 print(name)30 31 try: 32 print("Plotting "+name+"_A.nc") 31 33 nc1=Dataset(name+"_A.nc") 32 34 except: 35 print("Plotting "+name+".nc") 33 36 nc1=Dataset(name+".nc") 34 alt= nc1.variables["altitude"][:]35 lat= nc1.variables["lat"][:]36 lon= nc1.variables["lon"][:]37 alt=getvar(nc1,"altitude") 38 lat=getvar(nc1,"latitude") 39 lon=getvar(nc1,"longitude") 37 40 # temp=switchlon(temp) 38 lon=lon+180.39 41 40 def plot_alt(altitude = 1000): 42 if lon[0]<0: 43 lon=lon+180. 44 45 def plot_alt(altitude = 1): 41 46 temp=nc1.variables["temperature"][:,:,:,:] 42 47 numalt=getind(altitude,alt) … … 63 68 64 69 mpl.grid() 65 mpl.title(f"Temperatures @ z={altitude /1000}km",fontsize=font)70 mpl.title(f"Temperatures @ z={altitude}km",fontsize=font) 66 71 mpl.ylabel(r'Latitude',labelpad=10,fontsize=font) 67 72 mpl.xlabel('Longitude',labelpad=10, fontsize=font) … … 72 77 mpl.yticks(yticks,fontsize=font) 73 78 mpl.xticks(xticks,fontsize=font) 74 mpl.savefig(f"maptemp{altitude}",bbox_inches='tight',dpi=70) 79 output=f"maptemp{altitude}" 80 mpl.savefig(output,bbox_inches='tight',dpi=70) 81 print(f"Saved {output}") 75 82 #mpl.show() 76 83 77 84 78 plot_alt(1 000)79 plot_alt(5 000)80 plot_alt(20 000)81 plot_alt(50 000)82 plot_alt(100 000)85 plot_alt(1) 86 plot_alt(5) 87 plot_alt(20) 88 plot_alt(50) 89 plot_alt(100)
Note: See TracChangeset
for help on using the changeset viewer.