Back to Nutria ¦ Start Page

Convert All SDC With Installed HydroVish

HydroVish.inc


 
    # Define a gmake function to encode paths in URL format
    space=${} # defining a space
    encode=$(subst $(space),+,$(subst :,%3A,$(subst \,%2F,$(subst /,%2F,$(1)))))


    # Specify path to HydroVish.exe here.
    HydroVish.exe=C:/Users/$(USER)/AirborneHydroMapping/HydroVish/bin/win64/HydroVish.exe

    HydroVish=QUERY_STRING="$(call encode,$1&Action=Process)" $(HydroVish.exe)

    # Defining a make function to convert SDC files to F5
    # Parameters:
    #     $1 .... gridname
    SDCtoF5=$(call HydroVish,InputFiles=$<&Nutrition::gridname=$(gridname)&Output Folder=$(abspath $(dir $@))&Nutrition=SDC to F5)

    export REQUEST_METHOD=GET

    

HydroVish.rules



    # Pattern Rules to convert each SDC file, setting the QUERY_STRING environment variable as part of the rule
    %.f5: $(InputDir)/%.sdc | $(HydroVish.exe)
        $(call SDCtoF5,$(gridname))

    clean:
        $(RM) *.f5

    define  NoHydroVishInstalled.message


    *** ERROR ***
    HydroVish was not installed in its default path $(HydroVish.exe) .

    Please re-install HydroVish using the default settings or edit HydroVish.inc .
    Alternatively, you may also specify the path on the makefile command line, for instance:

    $(MAKE) -j HydroVish.exe=$HOME/vish/bin/arch-x86_64-w64-mingw32-Optimize/HydroVish.exe


    endef

    $(HydroVish.exe):
        $(error $(NoHydroVishInstalled.message))
    

Makefile


 
    InputDir=C:/Users/$(USERNAME)/AirborneHydroMapping/HydroVish/data/SampleData/FWF

    gridname=TestData

    # Generate the list of output files from all SDC files in the input directory.
    # The only parameter to specify is the InputDir and the (optional) gridname
    ResultFiles=$(subst .sdc,.f5,$(notdir $(wildcard $(InputDir)/*.sdc)))

    Result: $(ResultFiles)


    # Placing function definitions in its own include file
    include HydroVish.inc


    # Also placing rules in its own include file,
    # all of those rules are project-independent
    include HydroVish.rules
   
    


Back to Nutria ¦ Start Page