[MITgcm-support] Forcing

Martin Losch Martin.Losch at awi.de
Tue Oct 16 10:35:36 EDT 2018


Hi Mathilde,

it’s easier to convert your forcing into something the MITgcm can read, that write new input code. (Having said that, it would be great, if we could have code reading netcdf input files!!!)

It’s easy to convert your files into the required format (unblocked ieee-be files, i.e. there is no format, just all values written in a row in the “ocrrect” order) in python or matlab. You need one file per forcing field (i.e. zonal wind, meridional wind, downward lw radiation, etc.) There are many examples, how to do this in principle in the verification experiments, but here’s a code snippet for python:

data is a numpy array with the dimensions time, lat, lon, that contains all of your records.

import numpy as np
import sys
if sys.byteorder == 'little': data.byteswap(True)
fid = open(fname,"wb")
data.tofile(fid)
fid.close()
# switch back to machine format
if sys.byteorder == 'little': data.byteswap(True)

in matlab it’s very similar:

data(nx,ny,nt) (note the order of dimensions is reversed)

fid=fopen(fname,’b’,’w’); 
fwrite(fid,data,’real*4’); % if you want to use single precision
fclose(fid);

Martin

> On 16. Oct 2018, at 15:51, Mathilde Jutras <mathilde.jutras at mail.mcgill.ca> wrote:
> 
> Hi,
> 
> I would like to force the MITgcm with a forcing different than JRA25. Instead of having one file per field per year, I have one file per day per field. Also, since the JRA25 files are in binary format, it is hard to know what is the format inside. 
> Is there an option to easily have the code read a different file format, or are there some codes to put the forcing in the right format?
> 
> Thank you,
> 
> Mathilde Jutras
> McGill University
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support



More information about the MITgcm-support mailing list