Changeset 1100 in lmdz_wrf
- Timestamp:
- Sep 12, 2016, 11:18:53 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r1098 r1100 325 325 check_arguments(fname,str(idate)+','+str(edate)+','+str(totunits),expectargs,',') 326 326 327 readyT = ['year','month','week','day','hour','minute','second'] 328 327 329 # Checking length 328 330 Lidate = len(idate) … … 416 418 # Looking for number of months tacking exact beginning of the units [iYYYY][iMM]01000000, [eYYYY][eMM+1]01000000 417 419 ## 418 if totunits == 'month':420 elif totunits == 'month': 419 421 itime = int(iyrS)*100 + int(imoS) 420 422 if edate[6:15] != '01000000': … … 451 453 oinf = oinf + ',' + str(Nmonths) + ',' + ExactMonths 452 454 455 # Looking for number of days tacking exact beginning of the units [iYYYY][iMM][iDD]000000, [eYYYY][eMM][eDD+7]000000 456 ## 457 elif totunits == 'week': 458 itime = dt.datetime(int(iyrS),int(imoS),int(idaS),0,0,0) 459 if edate[8:15] != '000000': 460 etime = dt.datetime(int(eyrS), int(emoS), int(edaS)+7,0,0,0) 461 else: 462 etime = edateT 463 464 Ndays = 1 465 ExactDays = itime.strftime("%Y%m%d%H%M%S") 466 it = itime 467 while it + dt.timedelta(days=7) <= etime: 468 it = it + dt.timedelta(days=7) 469 Ndays = Ndays + 7 470 ExactDays = ExactDays + '@' + it.strftime("%Y%m%d%H%M%S") 471 472 oinf = oinf + ',' + str(Ndays) + ',' + ExactDays 473 453 474 # Looking for number of days tacking exact beginning of the units [iYYYY][iMM][iDD]000000, [eYYYY][eMM][eDD+1]000000 454 475 ## 455 if totunits == 'day':476 elif totunits == 'day': 456 477 itime = dt.datetime(int(iyrS),int(imoS),int(idaS),0,0,0) 457 478 if edate[8:15] != '000000': … … 472 493 # Looking for number of hours tacking exact beginning of the units [iYYYY][iMM][iDD][iHH]0000, [eYYYY][eMM][eDD][iHH+1]0000 473 494 ## 474 if totunits == 'hour':495 elif totunits == 'hour': 475 496 itime = dt.datetime(int(iyrS),int(imoS),int(idaS),int(ihoS),0,0) 476 497 if edate[10:15] != '0000': … … 491 512 # Looking for number of minutes tacking exact beginning of the units [iYYYY][iMM][iDD][iHH][iMI]00, [eYYYY][eMM][eDD][iHH][iMI+1]00 492 513 ## 493 if totunits == 'minute':514 elif totunits == 'minute': 494 515 itime = dt.datetime(int(iyrS),int(imoS),int(idaS),int(ihoS),int(imiS),0) 495 516 if edate[12:15] != '00': … … 511 532 # [eYYYY][eMM][eDD][iHH][iMI][iSE+1] 512 533 ## 513 if totunits == 'second':534 elif totunits == 'second': 514 535 itime = dt.datetime(int(iyrS),int(imoS),int(idaS),int(ihoS),int(imiS),int(iseS)) 515 536 if edate[12:15] != '00': … … 527 548 528 549 oinf = oinf + ',' + str(Nseconds) + ',' + ExactSeconds 550 551 else: 552 print errormsg 553 print ' '+ fname + ": totalunits '" + totunits + "' not ready !!" 554 print ' total time units ready:', readyT 555 quit(-1) 529 556 530 557 return oinf … … 8687 8714 [12 13]] 8688 8715 """ 8689 fname = ' dimoper_matrix'8716 fname = 'oper_submatrix' 8690 8717 8691 8718 operations = ['sumc', 'subc', 'mulc', 'divc', 'lowthres', 'upthres'] 8692 8719 matype = mat.dtype 8720 8721 print fname + '; Lluis: matype:', matype,'shape:',mat.shape,'opdims:',opdims 8693 8722 8694 8723 if oper.find(',') != -1: … … 8721 8750 Ndop = len(opdims) 8722 8751 Ntotdims = np.prod(ldimop) 8752 print fname + '; Lluis ldimop:', ldimop, 'Ntotdims:', Ntotdims 8723 8753 8724 8754 # Checking for coincidence in shapes
Note: See TracChangeset
for help on using the changeset viewer.