Changeset 3824 for trunk/LMDZ.MARS/util


Ignore:
Timestamp:
Jul 2, 2025, 2:58:14 PM (9 days ago)
Author:
jbclement
Message:

Mars PCM:
Small corrections to the "display_netcdf.py" script in the "util" folder.
JBC

Location:
trunk/LMDZ.MARS/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/util/display_netcdf.py

    r3818 r3824  
    210210            linewidth=0.5
    211211        )
    212         #gl.top_labels = False
    213         #gl.right_labels = False
    214212
    215213        # Plot data in PlateCarree projection
     
    229227        label = varname + (f" ({units})" if units else "")
    230228        cbar.set_label(label)
    231         ax.set_title(f"{varname} — {pole.capitalize()} Pole", pad=50)
     229        ax.set_title(f"{varname} — {pole.capitalize()} polar region", pad=20, y=1.05, fontsize=12, fontweight='bold')
    232230
    233231        figs.append(fig)
     
    362360
    363361    # Create plotter
    364     plotter = Plotter(title="3D topography view", bg="bb", axes=0)
     362    plotter = Plotter(title="3D globe view", bg="bb", axes=0)
    365363
    366364    # Configure camera
     
    409407        plt.xlabel(time_var or "Time Index")
    410408        plt.ylabel(varname + (f" ({var.units})" if hasattr(var, "units") else ""))
    411         plt.title(f"{varname} vs {time_var or 'Index'}")
     409        plt.title(f"{varname} vs {time_var or 'Index'}", fontweight='bold')
    412410        if output_path:
    413411            plt.savefig(output_path, bbox_inches="tight")
     
    442440        cbar = plt.colorbar()
    443441        cbar.set_label(varname + (f" ({var.units})" if hasattr(var, "units") else ""))
    444         plt.title(f"{varname} averaged over latitude")
     442        plt.title(f"{varname} averaged over latitude", fontweight='bold')
    445443        if output_path:
    446444            plt.savefig(output_path, bbox_inches="tight")
     
    564562                    cbar = fig.colorbar(cf, ax=ax, pad=0.02)
    565563                    cbar.set_label(varname + (f" ({var.units})" if hasattr(var, "units") else ""))
    566                     ax.set_title(f"{varname} (interpolated map over physical_points)")
     564                    ax.set_title(f"{varname} (interpolated map over physical_points)", fontweight='bold')
    567565                    ax.set_xlabel(f"Longitude ({getattr(dataset.variables[lonv], 'units', 'deg')})")
    568566                    ax.set_ylabel(f"Latitude ({getattr(dataset.variables[latv], 'units', 'deg')})")
     
    600598                plt.xlabel(varname + (f" ({var.units})" if hasattr(var, "units") else ""))
    601599                plt.ylabel(coord + (f" ({dataset.variables[coord].units})" if hasattr(dataset.variables[coord], "units") else ""))
    602                 plt.title(f"{varname} vs {coord}")
     600                plt.title(f"{varname} vs {coord}", fontweight='bold')
    603601                if output_path:
    604602                    plt.savefig(output_path, bbox_inches="tight")
     
    612610        plt.xlabel("Index")
    613611        plt.ylabel(varname + (f" ({var.units})" if hasattr(var, "units") else ""))
    614         plt.title(f"{varname} (1D)")
     612        plt.title(f"{varname} (1D)", fontweight='bold')
    615613        if output_path:
    616614            plt.savefig(output_path, bbox_inches="tight")
     
    620618        return
    621619
    622     # if dslice.ndim == 2:
     620    if dslice.ndim == 2:
    623621        lat_idx2 = find_dim_index(dims, LAT_DIMS)
    624622        lon_idx2 = find_dim_index(dims, LON_DIMS)
     
    630628            lats = dataset.variables[latv][:]
    631629            lons = dataset.variables[lonv][:]
     630
     631            # Correct latitudes order
     632            if lats[0] > lats[-1]:
     633                lats = lats[::-1]
     634                dslice = np.flipud(dslice)
    632635
    633636            # Handle masked arrays
     
    675678            cbar.set_label(varname + (f" ({dataset.variables[varname].units})"
    676679                                      if hasattr(dataset.variables[varname], "units") else ""))
    677             ax.set_title(f"{varname} (lat × lon)")
     680            ax.set_title(f"{varname} (lat × lon)", fontweight='bold')
    678681            ax.set_xlabel(f"Longitude ({getattr(dataset.variables[lonv], 'units', 'deg')})")
    679682            ax.set_ylabel(f"Latitude ({getattr(dataset.variables[latv], 'units', 'deg')})")
     
    702705        plt.xlabel("Dim 2 index")
    703706        plt.ylabel("Dim 1 index")
    704         plt.title(f"{varname} (2D)")
     707        plt.title(f"{varname} (2D)", fontweight='bold')
    705708        if output_path:
    706709            plt.savefig(output_path, bbox_inches="tight")
     
    891894        plt.xlabel(time_var or "Time Index")
    892895        plt.ylabel(varname + (f" ({var_obj.units})" if hasattr(var_obj, "units") else ""))
    893         plt.title(f"{varname} vs {time_var or 'Index'}")
     896        plt.title(f"{varname} vs {time_var or 'Index'}", fontweight='bold')
    894897        if output_path:
    895898            plt.savefig(output_path, bbox_inches="tight")
  • trunk/LMDZ.MARS/util/display_netcdf.yml

    r3818 r3824  
    163163  - mpg123=1.32.9=hc50e24c_0
    164164  - msgpack-python=1.1.1=py312h68727a3_0
    165   - multidict=6.6.2=py312h178313f_0
     165  - multidict=6.6.3=py312h178313f_0
    166166  - munkres=1.1.4=pyhd8ed1ab_1
    167167  - ncurses=6.5=h2d0b736_3
    168168  - netcdf4=1.7.2=nompi_py312h3805cb1_102
    169169  - nlohmann_json=3.12.0=h3f2d84a_0
    170   - numpy=2.3.0=py312h6cf2f7f_0
     170  - numpy=2.3.1=py312h6cf2f7f_0
    171171  - ocl-icd=2.3.3=hb9d3cd8_0
    172172  - opencl-headers=2025.06.13=h5888daf_0
     
    174174  - openjpeg=2.5.3=h5fbd93e_0
    175175  - openldap=2.6.10=he970967_0
    176   - openssl=3.5.0=h7b32b05_1
     176  - openssl=3.5.1=h7b32b05_0
    177177  - packaging=25.0=pyh29332c3_1
    178178  - pandas=2.3.0=py312hf9745cd_0
Note: See TracChangeset for help on using the changeset viewer.