[Dart-dev] DART/branches Revision: 11199

dart at ucar.edu dart at ucar.edu
Mon Mar 6 15:37:35 MST 2017


hendric at ucar.edu
2017-03-06 15:37:30 -0700 (Mon, 06 Mar 2017)
54
new change path with some minor updates to pathnames




Added: DART/branches/rma_rearrange/change_path.csh
===================================================================
--- DART/branches/rma_rearrange/change_path.csh	                        (rev 0)
+++ DART/branches/rma_rearrange/change_path.csh	2017-03-06 22:37:30 UTC (rev 11199)
@@ -0,0 +1,111 @@
+set NO_REP = 'files_without_replacement.txt'
+
+rm -rf $NO_REP
+
+echo
+echo
+echo "=================================================================="
+echo "=================================================================="
+echo "Changing Pathnames : "`date`
+echo "=================================================================="
+echo "=================================================================="
+echo
+echo
+
+set NON_UNIQUE_FILE = 'not_unique_f90'
+
+foreach PATH_FILE(`find . -name "path_names_*" | sed "s/\.\///g"`)
+   echo " PATH_FILE : " $PATH_FILE
+   # grab just the filename and not the path
+   foreach FILE_LINE( `cat $PATH_FILE | rev | cut -d'/' -f1 | rev | sort`)
+     # echo "  init  FILE_LINE --- $FILE_LINE"
+     # if it is not a unique file skip it
+     cp $PATH_FILE $PATH_FILE.tmp 
+     if (`grep "^$FILE_LINE" "$NON_UNIQUE_FILE"` == '') then
+         set REPLACE = `find . -name $FILE_LINE | sed "s/\.\///g"`
+         echo "    FILE_LINE --- $FILE_LINE"
+         echo "    REPLACE   --- $REPLACE"
+         if ( `echo "$REPLACE"` == '' ) then
+            echo "    *** NOTHING TO REPLACE"
+            echo         "NOTHING TO REPLACE , \n    $PATH_FILE, $FILE_LINE" >> $NO_REP
+         else
+            sed "s#.*/$FILE_LINE#$REPLACE#" $PATH_FILE.tmp >! $PATH_FILE
+         endif
+     endif
+
+     if (`echo "$FILE_LINE" | grep "^diagnostics" ` != '') then
+        echo " DIAGNOSTICS  --- assimilation_code/programs/obs_diag"
+        sed "s#^diagnostics#assimilation_code/programs/obs_diag#" $PATH_FILE.tmp >! $PATH_FILE
+     endif
+
+     if (`echo "$FILE_LINE" | grep "^location" ` != '') then
+        echo "    LOCATION  --- assimilation_code/location"
+        sed "s#^location#assimilation_code/location#" $PATH_FILE.tmp >! $PATH_FILE
+     endif
+
+     if (`echo "$FILE_LINE" | grep "obs_kind_mod.f90"` != '') then
+        echo "    OBS_KIND  --- assimilation_code/modules/observations/obs_kind_mod.f90"
+        sed "s#.*/obs_kind_mod.f90#assimilation_code/modules/observations/obs_kind_mod.f90#" $PATH_FILE.tmp >! $PATH_FILE
+     endif
+
+     if (`echo "$FILE_LINE" | grep "obs_def_mod.f90"` != '') then
+        echo "    OBS_DEF   --- observations/forward_operators/obs_def_mod.f90"
+        sed "s#.*/obs_def_mod.f90#observations/forward_operators/obs_def_mod.f90#" $PATH_FILE.tmp >! $PATH_FILE
+
+     endif
+
+     if (`echo "$FILE_LINE" | grep "obs_model_mod.f90"` != '') then
+        echo "    OBS_MODEL  --- assimilation_code/modules/assimilation/obs_model_mod.f90" 
+        sed "s#.*/obs_model_mod.f90#assimilation_code/modules/assimilation/obs_model_mod.f90#" $PATH_FILE.tmp >! $PATH_FILE
+
+     endif
+   end
+
+   rm $PATH_FILE.tmp
+
+   #mv $PATH_FILE.tmp $PATH_FILE
+   
+   # sort $PATH_FILE > $PATH_FILE.tmp
+   # cp $PATH_FILE.tmp $PATH_FILE
+   ###t_ add asssimilation_code/modules/observations/obs_kind_mod.f90 
+   ### run preprocess first then run this script should replace obs_kind and obs_def mod
+   
+   # mv $PATH_FILE.tmp $PATH_FILE
+   # exit 0
+end
+
+echo
+echo
+echo "=================================================================="
+echo "=================================================================="
+echo "Changing MKMFs : "`date`
+echo "=================================================================="
+echo "=================================================================="
+echo
+echo
+
+foreach MKMF_FILE(`find . -name "mkmf_*" | sed "s/\.\///g"`)
+   echo " MKMF_FILE : " $MKMF_FILE
+   cp $MKMF_FILE $MKMF_FILE.tmp
+   sed "s#../../../mkmf#../../../build_templates#g" $MKMF_FILE.tmp >! $MKMF_FILE
+   rm $MKMF_FILE.tmp
+
+end
+
+echo
+echo


More information about the Dart-dev mailing list