I am generating Initial Conditions (IC) for my regional ocean model (Indian Ocean Region with 9km resolution) using both MATLAB and Python, reading the data from the same source. However, the resulting IC fields produced by MATLAB and Python are not identical. I would like to understand why these discrepancies occur and how to ensure that both MATLAB and Python generate consistent IC outputs from the same source dataset. The Python scripts used to generate the IC fields are from "https://github.com/ESMG/pyroms". The Matlab scripts used are taken from "https://github.com/myroms/roms_matlab". I have uploaded one spatial map of temperature in the surface layer highlighting major difference in the coastal area in both the ICs. It is observed that, Matlab can handle the boundaries smoothly but Python cannot do it (check the figure attached). As a result, model is blown up in case of IC from Python after few months. However, the model with Matlab IC runs smoothly without any interruption. I kept timestep (DT) equal to 300 for both the cases.
Decreasing DT to 120, the model with Python IC is running, but it blows up with DT 300. I want to run the model with DT equal to 300 (as it is running with Matlab IC).
Mismatch Between MATLAB and Python Initial Conditions
- arango
- Site Admin
- Posts: 1396
- Joined: Wed Feb 26, 2003 4:41 pm
- Location: DMCS, Rutgers University
- Contact:
Re: Mismatch Between MATLAB and Python Initial Conditions
We are responsible for maintaining the roms_matlab repository at
github.com/myroms, which is considered the official version of ROMS pre- and post-processing and evolves with its source code. The pyroms software are maintained by others. It seems to me that the problem is due to interpolation when a land/sea mask is present. We use specific interpolation/extrapolation in MATLAB. It will be easy for others to consolidate this strategy in Python.
There are several issues with the Python-generated figure. It looks like a coarser grid, and it has land/sea masking problems everywhere if you check carefully.
There are several issues with the Python-generated figure. It looks like a coarser grid, and it has land/sea masking problems everywhere if you check carefully.
Re: Mismatch Between MATLAB and Python Initial Conditions
Thank you for your response.