Changeset 3681 for trunk/LMDZ.MARS
- Timestamp:
- Mar 12, 2025, 11:06:49 AM (3 months ago)
- Location:
- trunk/LMDZ.MARS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/changelog.txt
r3648 r3681 4776 4776 == 26/02/2025 == JBC 4777 4777 Skipping non-numeric variables in the analysis of NetCDF files. 4778 4779 == 12/03/2025 == JBC 4780 Small improvements for the python script to display variables in a NetCDF file. -
trunk/LMDZ.MARS/util/display_netcdf.py
r3459 r3681 24 24 # Add '/' if the match is a directory 25 25 matches = [match + '/' if os.path.isdir(match) else match for match in matches] 26 27 26 try: 28 27 return matches[state] … … 81 80 # If the variable has a time dimension, ask for the time index 82 81 if 'Time' in dimensions: 83 time_index = int(input(f"Enter the time index (0 to {variable.shape[0] - 1}): ")) 82 if variable.shape[0] == 1: 83 time_index = 0 84 else: 85 time_index = int(input(f"Enter the time index (0 to {variable.shape[0] - 1}): ")) 84 86 else: 85 87 time_index = None … … 103 105 104 106 # Plot the selected variable 105 plt.figure(figsize =(10,6))106 plt.contourf(longitude,latitude,data_slice,cmap ='viridis')107 plt.figure(figsize = (10,6)) 108 plt.contourf(longitude,latitude,data_slice,cmap = 'jet') 107 109 plt.colorbar(label=f"{variable_name.capitalize()} (units)") # Adjust units based on your data 108 110 plt.xlabel('Longitude (degrees)')
Note: See TracChangeset
for help on using the changeset viewer.