Home >> Forums >> Generic regular grid model

Generic regular grid model

Hi folks,
i'm new in ichthyop modeling and find it can help me on my current lagrangian research. As ichthyop doesn't support HYCOM (yet) I rewrite the netcdf HYCOM file to try merging it to something like the mercator2d nc file (just "time", "lon", "lat" variable coordinates and "U", "V" variables). 
The simulation failed with an exception related to java index out of bounds, with may indicate mismatch on indexing of variables.
I really appreciate any help or advice on this issue.

Hydrodynamic dataset: 
Operating system: 
Mac OS X

Hello Roberto

Could you please send me your data files (via Dropbox or anything alike)? So that I can try to reproduce and solve the error.



Hi Nicolas,
many thanks for your quick reply! Attached you'll find a 4-day sample file and a python script I wrote to convert hycom in a generic 2d file.nc.
Thanks again,


Hi Roberto

I have found some issues in your input file:

- your NetCDF variables are stored in (time, lat, lon) but in the file it appears as (time, lon, lat).

- When working on regular grid, Ichthyop reads a 1D lon and lat array, while in your NetCDF file the coordinates are 2D.

You will find a Python file that I used to correct the file you provided me with.

Furthermore, in Ichthyop's configuration file, you need to modify the "Latitude of Rho points" (latitude in my case), "Longitude of Rho points" (longitude in my case) and "Average time ..." (time in this case) settings in the MERCATOR2D setting block.

Yet I have an error, since the model is unable to work on the time array. Indeed, in this case Ichthyop uses numerical time in the format "seconds since ...", while in your NetCDF file you have nothing alike.

Do you have any informations about the time array of your forcing files (such as first and last time step, record frequency)? There is easy ways in Python to handle this.




dear Nicolas,
tanks againg for you answer and time spending in this issue -- things are very clear, now.
I'll be busy till the end of this week but resuming this task by the weekend. 
Regarding "time" array, it comes from the HYCOM + NCODA Global 1/12 deg (GLBa0.08/expt_91.1) database, starting in Jan, 01, 2015, 00:00h with 1--day sampling interval.

Here is the corrections I did:

  1. set time block, "t"starting at zero seconds at 86400s sampling rate (1 day); also, setting the reference time to the same in the hydrodinamic model;
  2. change longitudes from (0, 360) to (-180, +180) orientation

and, voilà, the model runs great, now. Attatched we have the python script you provided (with those little adjustments) and the ichthyop config file.
Many thanks for you help (next step is install the nice nbtools package and plot some maps)  

Hi Roberto

I have looked at your file, and I don't think that the change in longitudes (0, 360) to (-180, 180) is properly coded. Are your grid global? If so, there is clearly a mistake. If the grid is local, it should work.