@@ -68,7 +68,7 @@ class TM5ObservationOperator(ObservationOperator):
self.Identifier=identifier# the identifier gives the model name
self.Version=version# the model version used
self.RestartFileList=[]
self.OutputFileList=()
self.OutputFileList=[]
self.RcFileType='None'
self.outputdir=None# Needed for opening the samples.nc files created
...
...
@@ -331,8 +331,7 @@ class TM5ObservationOperator(ObservationOperator):
"""
Make sure that parameter files are written to the TM5 inputdir, and that observation lists are present
"""
#LU tutaj generalnie sprawdzamy czy input sie zgadza, czyli czy istnieja wszystkie pliki parametrow oraz plik obserwacji wskazywany przez dacycle[obsopertor.inputfile]
#LU a potem jeszcze sprawdzmay czy jest odpowiedni executable, z tym ze nie bardzo wiem skad sie go bierze.
datadir=self.tm_settings['ct.params.input.dir']
ifnotos.path.exists(datadir):
msg="The specified input directory for the TM5 model to read from does not exist (%s), exiting..."%datadir
...
...
@@ -407,7 +406,11 @@ class TM5ObservationOperator(ObservationOperator):
shutil.copy(f,f.replace(sourcedir,targetdir))
logging.debug("All restart data have been copied from the restart/current directory to the TM5 save dir")
defrun_forecast_model(self):
self.prepare_run()
self.validate_input()
self.run()
self.save_data()
defrun(self):
"""
...
...
@@ -487,11 +490,11 @@ class TM5ObservationOperator(ObservationOperator):
#Samples.DaCycle = DaCycle # also embed object in Samples object so it can access cycle information for I/O etc #LU cykl zostaje przypisany probkom
#ObsOperator.DaCycle = DaCycle # also embed object in ObsOperator object so it can access cycle information for I/O etc #LU cykl zostaje przypisany obsoperatorowi
ObsOperator.initialize(DaCycle)# Setup Observation Operator #LU a pote mobsoperator jest inicjalizowany
StateVector.initialize(DaCycle)
defprepare_state(DaCycle,StateVector):
""" Set up the input data for the forward model: obs and parameters/fluxes"""
StateVector.initialize(DaCycle)#LU w prepare state inicjalizujemy wektor stanu ktoremu dopiero co przypisalismy wartosci.
#LU to jest zalezne od cyklu, i cykl pojedynczy moze miec time.restart lub moze nie miec.
ifnotDaCycle['time.restart']:#LU jesli jest to pierwszy cykl
ifnotDaCycle['time.restart']:
# Fill each week from n=1 to n=nlag with a new ensemble
nlag=StateVector.nlag#LU dla kazdego od zera do dlugosc(cykl) wyznaczamy date oraz znajdujemy kowariancje i robimy nowa ensemble.
forninrange(nlag):
date=DaCycle['time.start']+datetime.timedelta(days=(n+0.5)*int(DaCycle['time.cycle']))#LU ta data jest tutaj potrzebna tylko do znalezienia odpowiedniego pliku z kowariancja.
StateVector.write_members_to_file(lag,DaCycle['dir.input'])#LU parameters.nc to be an input for tm5
Samples.initialize(DaCycle)#LU to daje przede wszystkim zresetowanie data list. czyli to znaczy ze data list jest za kazdym razem nowa przy odpalaniu nowego cyklu
Samples.add_observations()#LU obserwacje mamy z pliku observations, tutaj dodajemy tylko ten ich fragment ktory zawiera dany przedzial czasowy (ale ladujemy wszystko)
Samples.initialize(DaCycle)
Samples.add_observations()
# Add model-data mismatch to all samples, this *might* use output from the ensemble in the future??
# This is to make sure that the first step of the system uses all observations available, while the subsequent
# steps only optimize against the data at the front (lag==nlag) of the filter. This way, each observation is used only
# (and at least) once # in the assimilation
#LU czyli ze zawsze zapisujemy obserwacje i robimy sampling i zawsze mamy potem flask_output. i naewt zawsze go potem wczytujemy i dodajemy do samples... hmm co?
#LU aha , samples maja zawsze zerowane data list i przypisany start i end. w samples.initialize() w niniejszej funkcji. i potem w zaleznosci od tego czy zaszly ponizsze warunki, dodajemy je do asymilacji badz nie
#LU jaki to ma sens: taki ze zawsze mamy flask_output.nc. tylko ze on jest chyba nadpisywany za kazdym cyklem? no coz.. chyba byla na ten temat dyskusja, i wyszlo ze for debugging. niech i tak zostanie.
sample_step(DaCycle,Samples,StateVector,ObservationOperator,0)#LU w srodku zmienia zawartosc obiektu samples
#LU ale z drugiej strony dodaje tez pozniej samples, to tak jakby chcial na nowo dodac ...
#LU a to dlatego ze samples jest inicjalizowane na nowo.
#LU skoro w srodku sample step jest inicjalizowanie samples przez przypisanie datalist=[], to czy ten obiekt samples ma jkaies podobiekty ktore kaza mu byc przekazywanym?