Subversion Repositories lagranto.wrf

Rev

Rev 11 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11 Rev 21
Line 49... Line 49...
49
     set inpfile   = $2
49
     set inpfile   = $2
50
     set outfile   = $3
50
     set outfile   = $3
51
   endif
51
   endif
52
endif
52
endif
53
 
53
 
-
 
54
if ( "${mode}" == "-vec2ll" ) then
-
 
55
   set inpfile   = $2
-
 
56
   set outfile   = $3
-
 
57
   set vectorx   = $4
-
 
58
   set vectory   = $5
-
 
59
endif
-
 
60
 
-
 
61
if ( "${mode}" == "-vec2xy" ) then
-
 
62
   set inpfile   = $2
-
 
63
   set outfile   = $3
-
 
64
   set vectorx   = $4
-
 
65
   set vectory   = $5
-
 
66
endif
-
 
67
 
54
if ( "${mode}" == "-p2z" ) then
68
if ( "${mode}" == "-p2z" ) then
55
   set flag = `${LAGRANTO}/bin/isnumber $2`
69
   set flag = `${LAGRANTO}/bin/isnumber $2`
56
   if ( "${flag}" == "1" ) then
70
   if ( "${flag}" == "1" ) then
57
   	 set mode   = "-p2z.single"
71
   	 set mode   = "-p2z.single"
58
   	 set xpos   = $2
72
   	 set xpos   = $2
Line 440... Line 454...
440
 
454
 
441
# Make clean
455
# Make clean
442
\rm -f wrfmap.param
456
\rm -f wrfmap.param
443
 
457
 
444
endif
458
endif
-
 
459
 
-
 
460
# -----------------------------------------------------------------------------
-
 
461
# Transform vector x/y-relative -> lon/lat-relative
-
 
462
# -----------------------------------------------------------------------------
-
 
463
 
-
 
464
if ( "${mode}" == "-vec2ll" ) then
-
 
465
 
-
 
466
# Test whether input file is present
-
 
467
if ( ! -f ${inpfile} ) then
-
 
468
   echo " ERROR: input file ${inpfile} is missing... Stop"
-
 
469
   exit 1
-
 
470
endif
-
 
471
 
-
 
472
# Decide whether startfile has an explicit format specifier
-
 
473
set format = "0"
-
 
474
foreach app ( 1 2 3 4 5 6 7 8 9 )
-
 
475
  set flag = `echo ${inpfile} | grep ".${app}"`
-
 
476
  if ( "${flag}" != "" ) set format = "${app}"
-
 
477
end
-
 
478
 
-
 
479
# If format is 0, it might nevertheless be a hidden format 1
-
 
480
if ( "${format}" == "0" ) then
-
 
481
    set ncol = `awk "{print NF}" ${inpfile} | tail -1` 
-
 
482
    if ( "${ncol}" != "3" ) then
-
 
483
        set format = "1"
-
 
484
        echo " WARNING: ${inpfile} is a hidden trajectory file of format 1"
-
 
485
        echo "          it will be renamed: ${inpfile} -> ${inpfile}.1"
-
 
486
        echo
-
 
487
        ln -sf ${inpfile} ${inpfile}.1
-
 
488
        set inpfile = "${inpfile}.1"
-
 
489
    endif
-
 
490
endif
-
 
491
 
-
 
492
# Get the number of trajectories
-
 
493
if ( "${format}" == "0" ) then
-
 
494
   set ntra = `wc -l ${inpfile} | awk '{print $1}' `
-
 
495
   set ncol = 3
-
 
496
   set ntim = 1
-
 
497
else
-
 
498
   set ntra = `${LAGRANTO}/goodies/trainfo.sh ${inpfile} ntra`
-
 
499
   set ncol = `${LAGRANTO}/goodies/trainfo.sh ${inpfile} ncol`
-
 
500
   set ntim = `${LAGRANTO}/goodies/trainfo.sh ${inpfile} ntim`
-
 
501
endif
-
 
502
 
-
 
503
# Prepare parameter file and run Fortran code
-
 
504
\rm -f wrfmap.param 
-
 
505
echo \"${mode}\"             >! wrfmap.param
-
 
506
echo \"${inpfile}\"          >> wrfmap.param
-
 
507
echo \"${outfile}\"          >> wrfmap.param
-
 
508
echo ${ntra} ${ntim} ${ncol} >> wrfmap.param
-
 
509
echo \"${vectorx}\"          >> wrfmap.param
-
 
510
echo \"${vectory}\"          >> wrfmap.param
-
 
511
 
-
 
512
${LAGRANTO}/goodies/wrfmap
-
 
513
 
-
 
514
# Make clean
-
 
515
\rm -f wrfmap.param
-
 
516
 
-
 
517
endif
-
 
518
 
-
 
519
# -----------------------------------------------------------------------------
-
 
520
# Transform vector lon/lat-relative -> x/y-relative
-
 
521
# -----------------------------------------------------------------------------
-
 
522
 
-
 
523
if ( "${mode}" == "-vec2xy" ) then
-
 
524
 
-
 
525
# Test whether input file is present
-
 
526
if ( ! -f ${inpfile} ) then
-
 
527
   echo " ERROR: input file ${inpfile} is missing... Stop"
-
 
528
   exit 1
-
 
529
endif
-
 
530
 
-
 
531
# Decide whether startfile has an explicit format specifier
-
 
532
set format = "0"
-
 
533
foreach app ( 1 2 3 4 5 6 7 8 9 )
-
 
534
  set flag = `echo ${inpfile} | grep ".${app}"`
-
 
535
  if ( "${flag}" != "" ) set format = "${app}"
-
 
536
end
-
 
537
 
-
 
538
# If format is 0, it might nevertheless be a hidden format 1
-
 
539
if ( "${format}" == "0" ) then
-
 
540
    set ncol = `awk "{print NF}" ${inpfile} | tail -1` 
-
 
541
    if ( "${ncol}" != "3" ) then
-
 
542
        set format = "1"
-
 
543
        echo " WARNING: ${inpfile} is a hidden trajectory file of format 1"
-
 
544
        echo "          it will be renamed: ${inpfile} -> ${inpfile}.1"
-
 
545
        echo
-
 
546
        ln -sf ${inpfile} ${inpfile}.1
-
 
547
        set inpfile = "${inpfile}.1"
-
 
548
    endif
-
 
549
endif
-
 
550
 
-
 
551
# Get the number of trajectories
-
 
552
if ( "${format}" == "0" ) then
-
 
553
   set ntra = `wc -l ${inpfile} | awk '{print $1}' `
-
 
554
   set ncol = 3
-
 
555
   set ntim = 1
-
 
556
else
-
 
557
   set ntra = `${LAGRANTO}/goodies/trainfo.sh ${inpfile} ntra`
-
 
558
   set ncol = `${LAGRANTO}/goodies/trainfo.sh ${inpfile} ncol`
-
 
559
   set ntim = `${LAGRANTO}/goodies/trainfo.sh ${inpfile} ntim`
-
 
560
endif
-
 
561
 
-
 
562
# Prepare parameter file and run Fortran code
-
 
563
\rm -f wrfmap.param 
-
 
564
echo \"${mode}\"             >! wrfmap.param
-
 
565
echo \"${inpfile}\"          >> wrfmap.param
-
 
566
echo \"${outfile}\"          >> wrfmap.param
-
 
567
echo ${ntra} ${ntim} ${ncol} >> wrfmap.param
-
 
568
echo \"${vectorx}\"          >> wrfmap.param
-
 
569
echo \"${vectory}\"          >> wrfmap.param
-
 
570
 
-
 
571
${LAGRANTO}/goodies/wrfmap
-
 
572
 
-
 
573
# Make clean
-
 
574
\rm -f wrfmap.param
-
 
575
 
-
 
576
endif
-
 
577