source: CPL/oasis3-mct/branches/OASIS3-MCT_2.0_branch/util/oasisgui/library/oasis3-mct/scripts/write_namcouple.py @ 4775

Last change on this file since 4775 was 4775, checked in by aclsce, 5 years ago
  • Imported oasis3-mct from Cerfacs svn server (not suppotred anymore).

The version has been extracted from https://oasis3mct.cerfacs.fr/svn/branches/OASIS3-MCT_2.0_branch/oasis3-mct@1818

  • Property svn:executable set to *
File size: 30.9 KB
Line 
1from XDR import *
2
3
4###########################
5# INITIALIZATION
6
7init()
8
9nam = WriteAsciiFile("namcouple")
10
11nam.writeLine( """# This is a typical input file for OASIS3-MCT, using NetCDF
12# format for restart input files. OASIS3-MCT reads in this file
13# at run time. Don't hesitate to ask precisions or make
14# suggestions (oasishelp@cerfacs.fr)
15#
16# Any line beginning with # is ignored. Blank lines are not allowed
17####################################################################""")
18
19###########################
20# NFIELDS
21fieldsline = ""
22nb_fields = 0
23nam.writeLine( """ $NFIELDS """)
24
25fieldsline += "-to_be_replaced_nfields-"
26for fields in getChildrenName("flddef"):
27    nb_fields += 1
28
29fieldsline = fieldsline.replace("-to_be_replaced_nfields-",str(nb_fields))
30
31nam.writeLine( fieldsline )
32nam.writeLine( """ $END
33############################################""")
34
35
36###########################
37# MODELS
38model_names_list=[]
39nam.writeLine( """ $NBMODEL """)
40model_list = getChildrenName("models")
41model_names_list=getListValue("model_names_list")
42
43modelline = str(len(model_list))
44
45for model in model_names_list:
46    modelline+=" "
47    modelline+=model
48   
49for model in getChildrenName("models"):
50    if getValue("maxunits",model) == "units_on" :
51         modelline+=" "
52         modelline+=getValue("nunit",model)
53
54nam.writeLine( modelline )
55nam.writeLine( """ $END
56############################################""")
57
58
59###########################
60# RUNTIME
61nam.writeLine( """ $RUNTIME """)
62nam.writeLine( getValue("duration","runtime") )
63nam.writeLine( """ $END
64############################################""")
65
66###########################
67# DEBUG
68nam.writeLine( """ $NLOGPRT """)
69
70debugline = ""
71
72# Model : debugging options and time statistics
73if getValue("nlogprt") == "none" :
74    debugline+="0"
75if getValue("nlogprt") == "ptr_1" :
76    debugline+="1"
77if getValue("nlogprt") == "ptr_2" :
78    debugline+="2"
79if getValue("nlogprt") == "ptr_5" :
80    debugline+="5"
81if getValue("nlogprt") == "ptr_10" :
82    debugline+="10"
83if getValue("nlogprt") == "ptr_12" :
84    debugline+="12"
85if getValue("nlogprt") == "ptr_15" :
86    debugline+="15"
87if getValue("nlogprt") == "ptr_20" :
88    debugline+="20"
89if getValue("nlogprt") == "ptr_30" :
90    debugline+="30"
91
92
93debugline+=" "
94
95if getValue("opttime") == "none" :
96    debugline+="0"
97if getValue("opttime") == "opt_1" :
98    debugline+="1"
99if getValue("opttime") == "opt_2" :
100    debugline+="2"
101if getValue("opttime") == "opt_3" :
102    debugline+="3"
103
104nam.writeLine(debugline)
105nam.writeLine( """ $END
106############################################""")
107
108
109###########################
110# STRINGS
111nam.writeLine( """ $STRINGS """)
112
113# Everything will be stored in the variable gridline
114# the variable will be write a the end
115
116multiple_list= []
117mult_fields_name=[]
118mult_array={}
119grid_array={}
120grid_names_list=[]
121gridline=""
122new_field_names_list=[]
123before_field_name=""
124after_field_name=""
125
126# Get the list of multiple fields
127# Variable mult_fields_name is defined in the
128# script process_multiple.py : contains the
129# values single or multiple
130mult_fields_name=getListValue("mult_fields_name")
131grid_names_list=getListValue("grid_names_list")
132
133for mult in mult_fields_name:
134    if mult != "single" :
135        sendnames = []
136        recvnames = []
137        for fields in getChildrenName("flddef"):
138            if getValue("fldmult",fields) == mult:
139                send =getValue("fldnamebef",fields)   
140                recv =getValue("fldnameaft",fields)
141                field_label = getValue(fields)
142                for fields2 in getChildrenName("crs"):
143                   field_label2 = getValue(fields2,"crs")
144#                   print(field_label2)
145                   if field_label2 == field_label :
146                       statusf= getValue("status",fields2).upper()
147# Treat the case where the field is INPUT or OUTPUT :
148# source and target symbolic names must be the same
149                       if ( (statusf == "OUTPUT") or (statusf == "INPUT") ) :
150                           send = getValue("fldnamebef",fields)
151                           recv = getValue("fldnamebef",fields)   
152                sendnames.append(send)
153                recvnames.append(recv)
154                mult_array[mult,"sendnames"] = sendnames
155                mult_array[mult,"recvnames"] = recvnames
156#                print(sendnames)
157#                print(recvnames)
158
159# Create a dictionnary with the characteristics of the
160# different grids defined in Grids and used in Fields
161for gridid in getChildrenName("gridsline"):
162    grid_name=getValue(gridid)
163    grid_array[grid_name,"grid_name"] = grid_name
164    grid_array[grid_name,"grdstatus"] = getValue("gridstatus",gridid)
165    grid_array[grid_name,"overlap"] = getValue("grid_overlap",gridid)
166    grid_array[grid_name,"grddims"] = getValue("dimsgrid",gridid)
167    if grid_array[grid_name,"grddims"] == "dims_on":
168        grid_array[grid_name,"ni"] = getValue("ni_grid",gridid)
169        grid_array[grid_name,"nj"] = getValue("nj_grid",gridid)
170
171# Begin to store the data in gridline :
172# Get the field names to write the first line of STRING
173for fields in getChildrenName("flddef"):
174    mult_cat = getValue("fldmult",fields)
175#    print("mult_cat",mult_cat)
176    if (mult_cat == "single") :
177        field_label = getValue(fields)
178        for fields2 in getChildrenName("crs"):
179            field_label2 = getValue(fields2,"crs")
180            if field_label == field_label2 :
181                statusf= getValue("status",fields2).upper()
182                if ( (statusf == "OUTPUT") or (statusf == "INPUT") ) :
183                    gridline+=getValue("fldnamebef",fields)
184                    gridline+=" "
185                    gridline+=getValue("fldnamebef",fields)
186                    gridline+=" " 
187                    gridline+="1"
188                    gridline+=" "
189                else :
190                    gridline+=getValue("fldnamebef",fields)
191                    gridline+=" "
192                    gridline+=getValue("fldnameaft",fields)
193                    gridline+=" " 
194                    gridline+="1"
195                    gridline+=" "
196    else: 
197        if mult_cat in multiple_list:
198            print ("Multiple field alreay treated")
199            field_label="nothing"
200        else :
201            multiple_list.append(mult_cat)
202            field_label=mult_cat
203            gridline+=":".join(mult_array[mult_cat,"sendnames"]) 
204            gridline+=" "
205            gridline+=":".join(mult_array[mult_cat,"recvnames"])
206            gridline+=" "
207            gridline+="1"
208            gridline+=" "
209
210    nb_transfo = 0
211
212# Get the coupling period, the restart file and the status
213# to write the first line of STRING
214    for fields2 in getChildrenName("crs"):
215        field_label2 = getValue(fields2,"crs")
216        if field_label == field_label2 :
217            gridline += getValue("cpl",fields2)
218            gridline+=" " 
219            gridline += "-to_be_replaced_ntransfo-"
220            gridline+=" " 
221            gridline += getValue("restart",fields2)
222            gridline+=" " 
223            gridline += getValue("status",fields2).upper()
224            gridline+="\n" 
225   
226# Get the grids informations to write the second line of STRING   
227# If the field is INPUT or OUTPUT no dimensions must be written
228    if (field_label != "nothing"):
229         src_name=getValue("srcgrid",fields)
230         tgt_name=getValue("tgtgrid",fields)
231         for fields2 in getChildrenName("crs"):
232             field_label2 = getValue(fields2,"crs")
233             if field_label == field_label2 :
234                  if (getValue("status",fields2) == "input"):
235                      gridline+=""
236                  if (getValue("status",fields2) == "output"):
237                       gridline+=src_name
238                       gridline+=" "
239                       gridline+=src_name
240                  if ((getValue("status",fields2) == "exported" or getValue("status",fields2) == "expout")):
241                      if (grid_array[src_name,"grddims"] == "dims_on"):
242                           gridline+=grid_array[src_name,"ni"]
243                           gridline+=" "
244                           gridline+=grid_array[src_name,"nj"]
245                           gridline+=" "
246                           gridline+=grid_array[tgt_name,"ni"]
247                           gridline+=" "
248                           gridline+=grid_array[tgt_name,"nj"]
249                           gridline+=" "
250                           gridline+=src_name
251                           gridline+=" "
252                           gridline+=tgt_name
253                      else :
254                           gridline+=src_name
255                           gridline+=" "
256                           gridline+=tgt_name
257
258# Get the SEG and LAG values for the second line of STRING
259    if (field_label != "nothing"):
260         for fields2 in getChildrenName("crs"):
261             field_label2 = getValue(fields2,"crs")
262             if field_label == field_label2 :
263                  if (getValue("status",fields2) == "exported" or getValue("status",fields2) == "expout"):
264                      for fields3 in getChildrenName("seqlag","defseqlag"):
265                          field_label3 = getValue(fields3,"seqlag")
266                          if field_label == field_label3 : 
267                              if getValue("seq",fields3) == "seq_on" :
268                                   gridline+=" " 
269                                   gridline+="SEQ="+getValue("seq_fld",fields3)
270                              if getValue("lag",fields3) == "lag_on" :
271                                   gridline+=" " 
272                                   gridline+="LAG="+getValue("lag_fld",fields3)
273                              gridline+="\n"
274                  if (getValue("status",fields2) == "input"):
275                      gridline+=""
276                  if (getValue("status",fields2) == "output") :
277                      gridline+="\n"       
278
279# Write the third line of STRING : P or R and overlapping points
280    if (field_label != "nothing"):
281         for fields2 in getChildrenName("crs"):
282             field_label2 = getValue(fields2,"crs")
283             if field_label == field_label2 :
284                  if (getValue("status",fields2) == "exported" or getValue("status",fields2) == "expout"):
285                      src_status=grid_array[src_name,"grdstatus"]
286                      src_overlap=grid_array[src_name,"overlap"]
287                      tgt_status=grid_array[tgt_name,"grdstatus"]
288                      tgt_overlap=grid_array[tgt_name,"overlap"]
289                      if src_status == "periodical_grid" : 
290                          gridline+="P"
291                          gridline+=" "
292                          gridline+=src_overlap
293                          gridline+=" "
294                      elif src_status == "regional_grid" :
295                          gridline+="R"
296                          gridline+=" "
297                          gridline+=src_overlap
298                          gridline+=" "
299                      if tgt_status == "periodical_grid" : 
300                          gridline+="P"
301                          gridline+=" "
302                          gridline+=tgt_overlap
303                          gridline+=" "
304                      elif tgt_status == "regional_grid" :
305                          gridline+="R"
306                          gridline+=" "
307                          gridline+=tgt_overlap
308                          gridline+=" "
309                      gridline+="\n"
310
311# Transformations : write the fourth line of STRING with all the
312# transformations that will be applied to the coupling field
313# If the field id INPUT or OUTPUT only LOCTRANS or no transfo are possible
314    if (field_label != "nothing"):
315         for fields100 in getChildrenName("crs"):
316             field_label100 = getValue(fields100,"crs")
317             if field_label == field_label100 :
318                  if (getValue("status",fields100) == "exported" or getValue("status",fields100) == "expout"):
319                      for fields2 in getChildrenName("time"):
320                          field_label2 = getValue(fields2,"time")
321                          if field_label == field_label2 :
322                              if getValue("loctrans",fields2) == "loctrans_on" :
323                                  nb_transfo += 1
324                                  gridline+="LOCTRANS"
325                                  gridline+=" "
326                      for fields2 in getChildrenName("checkinoutminmax"):
327                          field_label2 = getValue(fields2,"checkinoutminmax")
328                          if field_label == field_label2 :
329                              if getValue("checkin",fields2) == "checkin_on" :
330                                  nb_transfo += 1
331                                  gridline+="CHECKIN"
332                                  gridline+=" "
333                      for fields2 in getChildrenName("multaddoldnew"):
334                          field_label2 = getValue(fields2,"multaddoldnew")
335                          if field_label == field_label2 :
336                              if getValue("blasold",fields2) == "blasold_on" :
337                                  nb_transfo += 1
338                                  gridline+="BLASOLD"
339                                  gridline+=" "
340                      for fields2 in getChildrenName("interp"):
341                          field_label2 = getValue(fields2,"interp")
342                          if field_label == field_label2 :
343                              if getValue("scrip",fields2) == "scrip_on" :
344                                  nb_transfo += 1
345                                  gridline+="SCRIPR"
346                                  gridline+=" "
347                      for fields2 in getChildrenName("map"):
348                          field_label2 = getValue(fields2,"map")
349                          if field_label == field_label2 :
350                              if getValue("mapremapping",fields2) == "mapping_on" :
351                                  nb_transfo += 1
352                                  gridline+="MAPPING"
353                                  gridline+=" "
354                      for fields2 in getChildrenName("conservation"):
355                          field_label2 = getValue(fields2,"conservation")
356                          if field_label == field_label2 :
357                              if getValue("conservopt",fields2) == "conserv_on" :
358                                  nb_transfo += 1
359                                  gridline+="CONSERV"
360                                  gridline+=" "
361                      for fields2 in getChildrenName("multaddoldnew"):
362                          field_label2 = getValue(fields2,"multaddoldnew")
363                          if field_label == field_label2 :
364                              if getValue("blasnew",fields2) == "blasnew_on" :
365                                  nb_transfo += 1
366                                  gridline+="BLASNEW"
367                                  gridline+=" "
368                      for fields2 in getChildrenName("checkinoutminmax"):
369                          field_label2 = getValue(fields2,"checkinoutminmax")
370                          if field_label == field_label2 :
371                              if getValue("checkout",fields2) == "checkout_on" :
372                                  nb_transfo += 1
373                                  gridline+="CHECKOUT"
374                                  gridline+=" "
375                              gridline+="\n"
376
377                      if (nb_transfo == 0 and field_label != "nothing"):
378                          error("Number of transformations cannot be 0")
379
380                  else : 
381                      print("Only LOCTRANS transformation is possible for INPUT and OUTPUT coupling fields") 
382                      for fields2 in getChildrenName("time"):
383                          field_label2 = getValue(fields2,"time")
384                          if field_label == field_label2 :
385                              if getValue("loctrans",fields2) == "loctrans_on" :
386                                  nb_transfo += 1
387                                  gridline+="LOCTRANS"
388                                  gridline+="\n"
389 
390    gridline = gridline.replace("-to_be_replaced_ntransfo-",str(nb_transfo))
391#
392# Write characteristics of the different transformations 
393# on the last lines of STRING for each field
394
395    if (field_label != "nothing"):
396         for fields100 in getChildrenName("crs"):
397             field_label100 = getValue(fields100,"crs")
398             if field_label == field_label100 :
399                  if (getValue("status",fields100) == "exported" or getValue("status",fields100) == "expout"):
400# LOCTRANS         
401                      for fields2 in getChildrenName("time"):
402                          field_label2 = getValue(fields2,"time")
403                          if field_label == field_label2 :
404                              if getValue("loctrans",fields2) == "loctrans_on" :
405                                  myvalue=""
406                                  myvalue+= getValue("loctransdef",fields2)
407                                  gridline+= myvalue.upper()
408                                  gridline+=" "
409                                  gridline+="\n"
410# CHECKIN
411                      for fields2 in getChildrenName("checkinoutminmax"):
412                          field_label2 = getValue(fields2,"checkinoutminmax")
413                          if field_label == field_label2 :
414                              if getValue("checkin",fields2) == "checkin_on" :
415                                  gridline+="INT=1"
416                                  gridline+="\n"
417# BLASOLD
418                      for fields2 in getChildrenName("multaddoldnew"):
419                          field_label2 = getValue(fields2,"multaddoldnew")
420                          if field_label == field_label2 :
421                              if getValue("blasold",fields2) == "blasold_on" :
422                                  gridline+= getValue("xmult_blso","blasold_on",fields2)
423                                  gridline+=" "
424                                  if getValue("xadd_blso","blasold_on",fields2) == "0." :
425                                      gridline+="0"
426                                      gridline+="\n"
427                                  else:
428                                      gridline+="1"
429                                      gridline+="\n"
430                                      gridline+= "CONSTANT"+" "+getValue("xadd_blso","blasold_on",fields2)
431                                      gridline+=" "
432                                      gridline+="\n"
433
434# SCRIPR
435                      for fields2 in getChildrenName("interp"):
436                          field_label2 = getValue(fields2,"interp")
437                          if field_label == field_label2 :
438                              if getValue("scrip",fields2) == "scrip_on" :
439                                  if getValue("scriprinterp",fields2) == "distwgt" :
440                                      gridline+="DISTWGT"
441                                      gridline+=" "
442                                      if getValue("cgrs_dist",fields2) == "lr_dist":
443                                          gridline+="LR"
444                                          gridline+=" "
445                                      elif getValue("cgrs_dist",fields2) == "d_dist":
446                                          gridline+="D"
447                                          gridline+=" "
448                                      elif getValue("cgrs_dist",fields2) == "u_dist":
449                                          gridline+="U"
450                                          gridline+=" "
451                                      gridline+="SCALAR"
452                                      gridline+=" "
453                                      if  getValue("rest_dist",fields2) == "latlon_dist":
454                                           gridline+= "LATLON"
455                                           gridline+= " "
456                                      elif getValue("rest_dist",fields2) == "latitude_dist":
457                                           gridline+= "LATITUDE"
458                                           gridline+= " "
459                                      gridline+= getValue("nbin_dist",fields2)
460                                      gridline+=" "
461                                      gridline+= getValue("nv_dist",fields2)
462                                      gridline+= "\n"
463                                  if getValue("scriprinterp",fields2) == "gauswgt" :
464                                      gridline+="GAUSWGT"
465                                      gridline+=" "
466                                      if getValue("cgrs_gaus",fields2) == "lr_gaus":
467                                          gridline+="LR"
468                                          gridline+=" "
469                                      elif getValue("cgrs_gaus",fields2) == "d_gaus":
470                                          gridline+="D"
471                                          gridline+=" "
472                                      elif getValue("cgrs_gaus",fields2) == "u_gaus":
473                                          gridline+="U"
474                                          gridline+=" "
475                                      gridline+="SCALAR"
476                                      gridline+=" "
477                                      if  getValue("rest_gaus",fields2) == "latlon_gaus":
478                                           gridline+= "LATLON"
479                                           gridline+= " "
480                                      elif getValue("rest_gaus",fields2) == "latitude_gaus":
481                                           gridline+= "LATITUDE"
482                                           gridline+= " "
483                                      gridline+= getValue("nbin_gaus",fields2)
484                                      gridline+=" "
485                                      gridline+= getValue("nv_gaus",fields2)
486                                      gridline+=" "
487                                      gridline+= getValue("var_gaus",fields2)
488                                      gridline+= "\n"
489                                  if getValue("scriprinterp",fields2) == "bilinear" :
490                                      gridline+="BILINEAR"
491                                      gridline+=" "
492                                      if getValue("cgrs_bili",fields2) == "lr_bili":
493                                          gridline+="LR"
494                                          gridline+=" "
495                                      elif getValue("cgrs_bili",fields2) == "d_bili":
496                                          gridline+="D"
497                                          gridline+=" "
498                                      gridline+="SCALAR"
499                                      gridline+=" "
500                                      if  getValue("rest_bili",fields2) == "latlon_bili":
501                                           gridline+= "LATLON"
502                                           gridline+= " "
503                                      elif getValue("rest_bili",fields2) == "latitude_bili":
504                                           gridline+= "LATITUDE"
505                                           gridline+= " "
506                                      gridline+= getValue("nbin_bili",fields2)
507                                      gridline+="\n"
508                                  if getValue("scriprinterp",fields2) == "bicubic" :
509                                      gridline+="BICUBIC"
510                                      gridline+=" "
511                                      if getValue("cgrs_bicu",fields2) == "lr_bicu":
512                                          gridline+="LR"
513                                          gridline+=" "
514                                      elif getValue("cgrs_bicu",fields2) == "d_bicu":
515                                          gridline+="D"
516                                          gridline+=" "
517                                      gridline+="SCALAR"
518                                      gridline+=" "
519                                      if  getValue("rest_bicu",fields2) == "latlon_bicu":
520                                           gridline+= "LATLON"
521                                           gridline+= " "
522                                      elif getValue("rest_bicu",fields2) == "latitude_bicu":
523                                           gridline+= "LATITUDE"
524                                           gridline+= " "
525                                      gridline+= getValue("nbin_bicu",fields2)
526                                      gridline+="\n"
527                                  if getValue("scriprinterp",fields2) == "conserv_interp" :
528                                      gridline+="CONSERV"
529                                      gridline+=" "
530                                      if getValue("cgrs_conserv",fields2) == "lr_conserv":
531                                          gridline+="LR"
532                                          gridline+=" "
533                                      elif getValue("cgrs_conserv",fields2) == "d_conserv":
534                                          gridline+="D"
535                                          gridline+=" "
536                                      elif getValue("cgrs_conserv",fields2) == "u_conserv":
537                                          gridline+="U"
538                                          gridline+=" "
539                                      gridline+="SCALAR"
540                                      gridline+=" "
541                                      if  getValue("rest_conserv",fields2) == "latlon_conserv":
542                                           gridline+= "LATLON"
543                                           gridline+= " "
544                                      elif getValue("rest_conserv",fields2) == "latitude_conserv":
545                                           gridline+= "LATITUDE"
546                                           gridline+= " "
547                                      gridline+= getValue("nbin_conserv",fields2)
548                                      gridline+=" "
549                                      if getValue("norm_conserv",fields2) == "fracnnei_conserv" :
550                                          gridline+= "FRACNNEI"
551                                          gridline+= " "
552                                      elif getValue("norm_conserv",fields2) == "fracarea_conserv" :
553                                          gridline+= "FRACAREA"
554                                          gridline+= " "
555                                      elif getValue("norm_conserv",fields2) == "destarea_conserv" :
556                                          gridline+= "DESTAREA"
557                                          gridline+= " "
558                                      if getValue("order_conserv",fields2) == "first_conserv" :
559                                          gridline+= "FIRST"
560                                          gridline+= "\n"
561                                      elif getValue("order_conserv",fields2) == "second_conserv" :
562                                          gridline+= "SECOND"
563                                          gridline+= "\n"
564
565# MAPPING
566                      for fields2 in getChildrenName("map"):
567                          field_label2 = getValue(fields2,"map")
568                          if field_label == field_label2 :
569                              if getValue("mapremapping",fields2) == "mapping_on" :
570                                  gridline+= getValue("filename",fields2)
571                                  gridline+=" "
572                                  gridline+= getValue("maploc",fields2)
573                                  gridline+=" "
574                                  gridline+= getValue("mapstrategy",fields2)
575                                  gridline+=" "
576                                  gridline+="\n"
577
578# CONSERV
579                      for fields2 in getChildrenName("conservation"):
580                          field_label2 = getValue(fields2,"conservation")
581                          if field_label == field_label2 :
582                              if getValue("conservopt",fields2) == "conserv_on" :
583                                  gridline+= getValue("conservstrategy",fields2).upper()
584                                  gridline+=" "
585                                  if getValue("conservalgo",fields2) == "bfb_conserv_on" :
586                                      gridline+="bfb"
587                                      gridline+=" "
588                                      gridline+="\n"
589                                  elif getValue("conservalgo",fields2) == "opt_conserv_on" :
590                                      gridline+="opt"
591                                      gridline+=" "
592                                      gridline+="\n"
593
594# BLASNEW
595                      for fields2 in getChildrenName("multaddoldnew"):
596                          field_label2 = getValue(fields2,"multaddoldnew")
597                          if field_label == field_label2 :
598                              if getValue("blasnew",fields2) == "blasnew_on" :
599                                  gridline+= getValue("xmult_blsn","blasnew_on",fields2)
600                                  gridline+=" "
601                                  if getValue("xadd_blsn","blasnew_on",fields2) == "0." :
602                                      gridline+="0"
603                                      gridline+="\n"
604                                  else:
605                                      gridline+="1"
606                                      gridline+="\n"
607                                      gridline+= "CONSTANT"+" "+getValue("xadd_blsn","blasnew_on",fields2)
608                                      gridline+=" "
609                                      gridline+="\n"
610# CHECKOUT
611                      for fields2 in getChildrenName("checkinoutminmax"):
612                          field_label2 = getValue(fields2,"checkinoutminmax")
613                          if field_label == field_label2 :
614                              if getValue("checkout",fields2) == "checkout_on" :
615                                  gridline+="INT=1"
616                                  gridline+="\n"
617#### HERE ELSE FOR INPUT and OUTPUT
618                  else :   
619# LOCTRANS         
620                      for fields2 in getChildrenName("time"):
621                          field_label2 = getValue(fields2,"time")
622                          if field_label == field_label2 :
623                              if getValue("loctrans",fields2) == "loctrans_on" :
624                                  myvalue=""
625                                  myvalue+= getValue("loctransdef",fields2)
626                                  gridline+= myvalue.upper()
627                                  gridline+=" "
628                                  gridline+="\n"
629
630    if (field_label == "nothing" ):
631        gridline+=""
632    else:
633        gridline+="####"
634        gridline+="\n"
635
636gridline += " $END"
637nam.writeLine(gridline)
638nam.writeLine("############################################")
639
640nam.close()
641
642# Write the namcouple in a window of the interface
643totaltime=getValue("duration","runtime")
644gridline2=gridline
645namcoupleline="$NFIELDS \n"+fieldsline+"\n"+"$END \n"+"####"+"\n"+"$NBMODEL \n"+modelline+"\n"+"$END \n"+"####"+"\n"+"$RUNTIME \n"+totaltime+"\n"+"$END \n"+"####"+"\n"+"$NLOGPRT \n"+debugline+"\n"+"$END \n"+"####"+"\n"+"$STRINGS \n"+gridline2
646setValue(namcoupleline,"namcouplescript")
647
648#########################
649# FINISHING
650finish()
651
652
653
654
Note: See TracBrowser for help on using the repository browser.