# How to creating initial file (ICMSH\* and ISMGG\*)?

**URL:** <https://forum.ecmwf.int/t/how-to-creating-initial-file-icmsh-and-ismgg/12193>\
**Category:** OpenIFS\
**Tags:** openifs-configuration-and-namelists, openifs-initial-data, openifs-43r3\
**Created:** [6 June 2022 12:21 UTC](https://forum.ecmwf.int/t/how-to-creating-initial-file-icmsh-and-ismgg/12193 "2022-06-06T12:21:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zhenqian\_Wang](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/z/6bbea6/32.png) [@Zhenqian\_Wang](https://forum.ecmwf.int/u/Zhenqian_Wang)\
**Post date:** [6 June 2022 12:21 UTC](https://forum.ecmwf.int/t/how-to-creating-initial-file-icmsh-and-ismgg/12193/1 "2022-06-06T12:21:54Z")

</div>

Hi ,

I'm wondering whether if i can&nbsp;creating initial file(ICMSH${expid}INIT) from existing NetCDF files?

I would like to design some sensitivity experiments, so i wont to create the initial file by NetCDF, i have tried to convert the \*.nc to \*.grb and replace the variables in&nbsp;existing initial file, but it didn't work, could some one tell me how to do it?

Best regards,

Zhenqian

wangzhenqian@wangzhenqiandeMacBook-Pro 19900101 % **cdo replace ICMSHECE3INIT T255\_no\_TP300\_mulc9.8\_chname.grb 123&nbsp;**

**cdo&nbsp; &nbsp; replace (Warning): Variable Z not found!**

**cdo&nbsp; &nbsp; replace: Processed 3642358 values from 42 variables over 2 timesteps [0.03s 9640KB].**

---

<div class="post-metadata">

**Author:** ![Glenn\_Carver](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/g/e495f1/32.png) [@Glenn\_Carver](https://forum.ecmwf.int/u/Glenn_Carver)\
**Post date:** [8 June 2022 21:07 UTC](https://forum.ecmwf.int/t/how-to-creating-initial-file-icmsh-and-ismgg/12193/2 "2022-06-08T21:07:16Z")

</div>

Hi Zhenqian,

I have not used the cdo replace command so I am not sure how it matches the fields between two grib files. Is your replacement field in spectral format as the ICMSH file contains the prognostic fields in spectral format.

Personally I would do this in several steps using the ECMWF ecCodes grib tools.&nbsp; You can do a 'smart copy' with the 'grib\_copy' command line tool to split the ICMSH file into 1 file per variable, then simply 'cat' the files back together again but this time with your replacement 'z' file.&nbsp; Unlike netcdf files, GRIB files can have fields in any order as each grib message is self describing.

Something like:

grib\_copy ICMSHECE3INIT&nbsp; "[shortName].ecgrb"  
 rm z.grb&nbsp; &nbsp; #&nbsp; or rename it  
 cat T255\*chname.grb \*.ecgrb&nbsp; \> new.grb  
  
 Then I suggest using the 'grib\_set' command to make sure the attributes of the new grib z field match the original.

Cheers.

---

<div class="post-metadata">

**Author:** ![Zhenqian\_Wang](https://forum.ecmwf.int/letter_avatar_proxy/v4/letter/z/6bbea6/32.png) [@Zhenqian\_Wang](https://forum.ecmwf.int/u/Zhenqian_Wang)\
**Post date:** [9 June 2022 11:06 UTC](https://forum.ecmwf.int/t/how-to-creating-initial-file-icmsh-and-ismgg/12193/3 "2022-06-09T11:06:59Z")

</div>

Hi Glenn Carver,

Thank you for your answer.

I haven't used ecCodes, I will learn this tool later. Does this tool could modified variable's value?

Best regards,

Zhenqian
