Firsly we need to install nassecery libaries if those are not installed
!pip3 install numpy
!pip3 install matplotlib
!pip3 install mitgcmutils
You can check if the required library is installed or not
try:
import MITgcmutils
print("mitgcmutils is installed.")
except ImportError:
print("mitgcmutils is not installed.")
Once the libaraires are installed, its time to import to our environment
import numpy as np
import matplotlib.pyplot as plt
import MITgcmutils as mit
Now, we assigned the path to a variable for further uses. Remember to remove .meta or .data from the path name.
meta_file = '/usr/bin/soft/MITgcm/verification/global_ocean.cs32x15/run/T.0000072000.001.001'
data_file = '/usr/bin/soft/MITgcm/verification/global_ocean.cs32x15/run/T.0000072000.001.001'
We will use the MITgcmutils to read the data. You can see that the data conatins a 3D data which is (Time, Lat, Lon).
# Read data using mitgcmutils
data = mit.rdmds(data_file)
data
data.shape
Here, it is a simple visualization.
# Define the figure size
fig, ax = plt.subplots(figsize=(20, 3))
# Plot the data
im = ax.imshow(data[1], cmap='viridis')
cbar = plt.colorbar(im, ax=ax)
# Customize the plot
ax.set_title('MITgcm Output Data')
plt.show()