Regridding Restarts for Fortuna 2.5: Difference between revisions

No edit summary
Line 47: Line 47:


For sources other than MERRA, you will have to specify the location of a regrid resource file that contains the model version, resolution and location of the source restarts, and the resolution of the output restarts.  A sample regrid resource file is <code>regrid.rc</code> in the same directory as the <code>regrid</code> script.  Note that  <code>regrid</code> only works for creating restarts for its model tag, and does not work at all for making restarts for tags before Fortuna 2.5.  Restarts for earlier model tags have to be created "manually".
For sources other than MERRA, you will have to specify the location of a regrid resource file that contains the model version, resolution and location of the source restarts, and the resolution of the output restarts.  A sample regrid resource file is <code>regrid.rc</code> in the same directory as the <code>regrid</code> script.  Note that  <code>regrid</code> only works for creating restarts for its model tag, and does not work at all for making restarts for tags before Fortuna 2.5.  Restarts for earlier model tags have to be created "manually".
== Renaming Restart Files ==
At this point you will have restart files with a fair bit of cruft in the filenames.  As described above, they will have to be renamed for the model to recognize them.  There are a number of scripts with different techniques for completing this tedious chore; here is one example:
<pre>
#!/usr/bin/env python
import re
import os
# Open file for reading
dirlist = os.listdir(".")
for file in dirlist:
  if( re.search(".*rst.*",file) ):
      print file
# the concept is to match ??????.something_rst.??????? OR something_rst.????????
# and extract "something_rst"
      newfile = re.sub(r'(^.+\.|^)([a-z_]+rst)\..+$',r'\2',file)
      print newfile
      if cmp(newfile,file):
        os.symlink(file,newfile)
</pre>
It will grab anything in the current working directory resembling the common forms of restart filename generated by the regridding scripts and other utilities and create symbolic links to them in the same directory with the superfluous parts of the filenames stripped.  In an experiment directory the links will be overwritten by the model with "fresh" restart files at the end of a run segment.  Alternatively, you can easily copy the restart files with <code>cp *rst</code>




Line 246: Line 274:
<code>lai_grn_clim</code> datasets.  For Fortuna 2.2 you do have to copy or link the <code>clsm</code> directory in directory with the appropriately-dimensioned tile files.
<code>lai_grn_clim</code> datasets.  For Fortuna 2.2 you do have to copy or link the <code>clsm</code> directory in directory with the appropriately-dimensioned tile files.


== Renaming Restart Files ==
At this point you will have restart files with a fair bit of cruft in the filenames.  As described above, they will have to be renamed for the model to recognize them.  There are a number of scripts with different techniques for completing this tedious chore; here is one example:
<pre>
#!/usr/bin/env python
import re
import os
# Open file for reading
dirlist = os.listdir(".")
for file in dirlist:
  if( re.search(".*rst.*",file) ):
      print file
# the concept is to match ??????.something_rst.??????? OR something_rst.????????
# and extract "something_rst"
      newfile = re.sub(r'(^.+\.|^)([a-z_]+rst)\..+$',r'\2',file)
      print newfile
      if cmp(newfile,file):
        os.symlink(file,newfile)
</pre>
It will grab anything in the current working directory resembling the common forms of restart filename generated by the regridding scripts and other utilities and create symbolic links to them in the same directory with the superfluous parts of the filenames stripped.  In an experiment directory the links will be overwritten by the model with "fresh" restart files at the end of a run segment.  Alternatively, you can easily copy the restart files with <code>cp *rst</code>


== Bootstrapping for a Complete Set of Restarts ==
== Bootstrapping for a Complete Set of Restarts ==