Mismatch Between MATLAB and Python Initial Conditions

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
prasanna1
Posts: 5
Joined: Tue Nov 16, 2021 2:08 pm
Location: INCOIS
Contact:

Mismatch Between MATLAB and Python Initial Conditions

#1 Unread post by prasanna1 »

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).
Attachments
IC using Matlab.png

User avatar
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

#2 Unread post by arango »

We are responsible for maintaining the roms_matlab repository at :arrow: 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.

prasanna1
Posts: 5
Joined: Tue Nov 16, 2021 2:08 pm
Location: INCOIS
Contact:

Re: Mismatch Between MATLAB and Python Initial Conditions

#3 Unread post by prasanna1 »

Thank you for your response.

Post Reply