Repository navigation
Initialisation NetCDF Restart
Another possibility to initialise the Osmose model is by using a NetCDF file.
This method is used if the simulation.restart.file or the population.initialization.file parameter is defined. The parameter gives the relative or absolute path to the NetCDF file.
These parameters point to the NetCDF file that will be used to initialise the simulation.
Restart files are automatically generated at the end of an Osmose simulation if the output.restart.enabled parameter is set to True. These files allow to continue a simulation, either from a specific point or if the simulation is interrupted. This is especially useful if you want to spin-up your simulation before running your hindcast simulation.
Note that one restart file per replicate is created, and the replicate index will be added after the .nc extension (for example med_snapshot_step2399.nc.0, med_snapshot_step2399.nc.1). However, the simulation.restart.file must not include the rank extension, that will be automatically added by Osmose.
Tip
Osmose will search for the ranked restart file first (med_snapshot_step2399.nc.0). If it does not exist, then the raw file path will be searched (med_snapshot_step2399.nc). This is a way to control that all your replicates use exactly the same restart.
Warning
When using a restart file, the simulation will start at the year when the restart was created. If you first run a 100 year simulation and then you use the restart to start a new simulation, the latter will start at year 100. Therefore, you need to adjust the
simulation.time.nyear parameter accordingly.
Caution
You cannot use the restart files generated with a classical Osmose simulation to restart a simulation with the bioenergetic or evolutionary module, since state variables associated with these two modules will be missing.
Population initialisation files can be generated by any means by the user as long as the expected format is used.
Tip
Osmose will search for the ranked initialisation file first (initialization_file.nc.0). If this does not exist, then the raw file path will be searched (initialization_file.nc). This is a way to control that all your replicates use exactly the same initialisation.
Warning
When using an initialisation file, the simulation will start at time step 0, as opposed to restart files, in which the first time step is read from the restart file.
These files are structured as follows in the classical Osmose model:
netcdf med_snapshot_step2399.nc {
dimensions:
nschool = 24681 ;
variables:
int species(nschool) ;
string species:description = "index of the species" ;
float x(nschool) ;
string x:units = "scalar" ;
string x:description = "x-grid index of the school" ;
float y(nschool) ;
string y:units = "scalar" ;
string y:description = "y-grid index of the school" ;
double abundance(nschool) ;
string abundance:units = "scalar" ;
string abundance:description = "number of fish in the school" ;
float age(nschool) ;
string age:units = "year" ;
string age:description = "age of the school in year" ;
float length(nschool) ;
string length:units = "cm" ;
string length:description = "length of the fish in the school in centimeter" ;
float weight(nschool) ;
string weight:units = "g" ;
string weight:description = "weight of the fish in the school in gram" ;
float trophiclevel(nschool) ;
string trophiclevel:units = "scalar" ;
string trophiclevel:description = "trophiclevel of the fish in the school" ;
// global attributes:
string :step = "2399" ;
string :species = "0=Alosaalosa 1=Alosafallax 2=Anguillaanguilla 3=Argyrosomusregius 4=Aristaeomorphafoliacea 5=Aristeusantennatus 6=Atherinaboyeri 7=Auxisrocheirochei 8=Belonebelone 9=Boopsboops 10=Caranxcrysos 11=Chelidonichthyslucerna 12=Corisjulis 13=Coryphaenahippurus 14=Crangoncrangon 15=Crystallogobiuslinearis 16=Dentexdentex 17=Dentexgibbosus 18=Dentexmaroccanus 19=Dicentrarchuslabrax 20=Diplodusannularis 21=Diploduscervinus 22=Diploduspuntazzo 23=Diplodussargussargus 24=Diplodusvulgaris 25=Eledonecirrhosa 26=Engraulisencrasicolus 27=Epinephelusaeneus 28=Epinephelusmarginatus 29=Etrumeusteres 30=Eutriglagurnardus 31=Galeusmelastomus 32=Gobiusniger 33=Halobatrachusdidactylus 34=Illexcoindetii 35=Lepidorhombuswhiffiagonis 36=Lizaaurata 37=Lizaramada 38=Lizasaliens 39=Loligovulgaris 40=Lophiusbudegassa 41=Lophiuspiscatorius 42=Merlangiusmerlangus 43=Merlucciusmerluccius 44=Micromesistiuspoutassou 45=Mugilcephalus 46=Mullusbarbatusbarbatus 47=Mullussurmuletus 48=Mustelusmustelus 49=Nephropsnorvegicus 50=Octopusvulgaris 51=Pagellusacarne 52=Pagelluserythrinus 53=Pagruspagrus 54=Palaemonserratus 55=Palinuruselephas 56=Parapenaeuslongirostris 57=Penaeuskerathurus 58=Phycisphycis 59=Platichthysflesusflesus 60=Pleuronectesplatessa 61=Pomatomussaltatrix 62=Pomatoschistusmarmoratus 63=Pomatoschistusminutus 64=Rhinobatosrhinobatos 65=Sardasarda 66=Sardinapilchardus 67=Sardinellaaurita 68=Sauridaundosquamis 69=Sciaenaumbra 70=Scomberjaponicus 71=Scomberscombrus 72=Scophthalmusmaximus 73=Scorpaenanotata 74=Scyliorhinuscanicula 75=Sepiaofficinalis 76=Serioladumerili 77=Serranusatricauda 78=Soleasolea 79=Sparusaurata 80=Sphyraenasphyraena 81=Sphyraenaviridensis 82=Spicaramaena 83=Spicarasmaris 84=Spondyliosomacantharus 85=Sprattussprattus 86=Squillamantis 87=Stephanolepisdiaspros 88=Thunnusalalunga 89=Thunnusthynnus 90=Trachurusmediterraneus 91=Trachuruspicturatus 92=Trachurustrachurus 93=Trachyrincusscabrus 94=Triglalyra 95=Trisopterusluscus 96=Trisopterusminutus 97=Upeneusmoluccensis 98=Xiphiasgladius 99=Zosterisessorophiocephalus 100=Zosteuphausiids " ;
:_NCProperties = "version=2,netcdf=4.7.4,hdf5=1.10.6" ;
}Note that the file only has one dimension, which is the number of schools, and contains all the state variables associated with the schools.