Changeset 3851 for trunk/LMDZ.MARS/util/display_netcdf.py
- Timestamp:
- Jul 16, 2025, 3:25:48 PM (9 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/util/display_netcdf.py
r3849 r3851 84 84 85 85 # Attempt to load MOLA topography 86 try: 87 MOLA = np.load( 'MOLA_1px_per_deg.npy') # shape (nlat, nlon) at 1° per pixel: lat from -90 to 90, lon from 0 to 36086 if os.path.isfile(MOLA_NPY): # shape (nlat, nlon) at 1° per pixel: lat from -90 to 90, lon from 0 to 360 87 MOLA = np.load(MOLA_NPY) 88 88 nlat, nlon = MOLA.shape 89 89 topo_lats = np.linspace(90 - 0.5, -90 + 0.5, nlat) … … 91 91 topo_lon2d, topo_lat2d = np.meshgrid(topo_lons, topo_lats) 92 92 topo_loaded = True 93 e xcept Exception ase:94 print(f"Warning: '{MOLA_NPY}' not found : {e}")93 else: 94 print(f"Warning: '{MOLA_NPY}' not found! Topography contours disabled.") 95 95 topo_loaded = False 96 96 … … 101 101 csv_loaded = True 102 102 else: 103 print(f"Warning: '{MOLA_CSV}' not found .3D view colors disabled.")103 print(f"Warning: '{MOLA_CSV}' not found! 3D view colors disabled.") 104 104 csv_loaded = False 105 105 … … 585 585 ax.set_ylabel(f"Latitude ({getattr(dataset.variables[latv], 'units', 'deg')})") 586 586 # Prompt for polar-stereo views if interactive 587 if input("Display polar-stereo views? [y /n]: ").strip().lower() == "y":587 if input("Display polar-stereo views? [y = yes, anything else = no]: ").strip().lower() == "y": 588 588 units = getattr(var, 'units', None) 589 589 plot_polar_views(lon2d, lat2d, grid, colormap, varname, units) 590 590 # Prompt for 3D globe view if interactive 591 if input("Display 3D globe view? [y /n]: ").strip().lower() == "y":591 if input("Display 3D globe view? [y = yes, anything else = no]: ").strip().lower() == "y": 592 592 units = getattr(var, 'units', None) 593 593 plot_3D_globe(lon2d, lat2d, grid, colormap, varname, units) … … 659 659 ax.grid(True) 660 660 # Prompt for polar-stereo views if interactive 661 if sys.stdin.isatty() and input("Display polar-stereo views? [y /n]: ").strip().lower() == "y":661 if sys.stdin.isatty() and input("Display polar-stereo views? [y = yes, anything else = no]: ").strip().lower() == "y": 662 662 units = getattr(dataset.variables[varname], "units", None) 663 663 plot_polar_views(x_coords, y_coords, plot_data, colormap, varname, units) 664 664 # Prompt for 3D globe view if interactive 665 if sys.stdin.isatty() and input("Display 3D globe view? [y /n]: ").strip().lower() == "y":665 if sys.stdin.isatty() and input("Display 3D globe view? [y = yes, anything else = no]: ").strip().lower() == "y": 666 666 units = getattr(dataset.variables[varname], "units", None) 667 667 plot_3D_globe(x_coords, y_coords, plot_data, colormap, varname, units)
Note: See TracChangeset
for help on using the changeset viewer.