Fortran outputs numbers like this 0.91576404D+00, where the D designates a double precision number. Grapher 11 and 13 both recognize these values as numeric, but Grapher 12 did not. To use these Fortran numbers in Grapher 12, follow these steps:
- Create a new folder to hold the updated data files.
- Copy the script below, or click here to download the BAS file: FindReplace_D.BAS.
- In a Windows Explorer window, navigate to C:\Program Files\Golden Software\Grapher 12.
- Double click on Scripter.exe to launch Scripter.
- Press Ctrl+A to select all of the existing lines then press Delete.
- If you copied this script, press Ctrl+V to paste it into Scripter. If you downloaded it, click File | Open, select the BAS file from your downloads directory, and click Open.
- On line 12, change the file path to the directory containing your data files.
- On line 13, change the file path to the new directory you created in step 1.
- On line 14, enter the first column that contains Fortran double-precision numbers.
- On line 15, enter the last column that contains Fortran double-precision numbers.
- On line 18, change "dat" to whatever file extension your data files have.
- Click Script | Run to run the script.
- If you have GRF files that link to these data files, after the script is done running, move the GRF files to the new folder created in step 1.
Sub Main 'Create Grapher as an Object Dim Grapher As Object 'Start Grapher Set Grapher = CreateObject("Grapher.Application") '===================================================== ' User-defined variables '===================================================== oldDataPath$ = "C:\Users\L\Desktop\OldData\" newDataPath$ = "C:\Users\L\Desktop\NewData\" firstcol = 2 'first column that contains the D+ designator lastcol = 2 'last column that contains the D+ designator '===================================================== file = Dir(oldDataPath$+"*.dat") While file <> "" 'Open the DAT in Grapher's worksheet Set Wks = Grapher.Documents.Open(oldDataPath$+file,"") 'Replace the D+ text with nothing, so the text becomes numeric Set WksRange = Wks.Columns(firstcol,lastcol) Set Current = Wks.Range("B1") Set Current = WksRange.Replace("D+","",Current,wksFindScopeEntire,wksFindPhrase,False,False,True,False) 'Save the file to the new file location Wks.SaveAs(newDataPath$+file) 'Get the next DAT file in the directory file = Dir() Wend 'After the script finishes, move all of the GRF files to the newDataPath$ directory End Sub
Updated February 1, 2018