Views:
  • Question:

    General: How can I extract depth-averaged values from a 3D dfsu file?

     

    Answer:

    It is possible to use a tool from the bin directory and execute it via the Launch Simulation Engine.

    The tool in question is called ‘DataVerticalAveragingFM.exe’. You have to create an input ascii file to define the data. You can extract more than one item at a time and you can choose the layer interval to use for the averaged values. The output will be a 2D dfsu file. An example with the first two items is shown below (NOTE: item numbering starts from 2):

     

    [DataVerticalAveragingFM]
       [INPUT]
         file_name = |volume.dfsu| 
       EndSect  // INPUT

       [OUTPUT]
         file_name = |velocity_depth_average.dfsu|
         title = 'my title'
         number_of_items = 2
         item_numbers = 2, 3
         mode = 1  
         first_layer = 1
         last_layer = 18
       EndSect  // OUTPUT

    EndSect // DataVerticalAveragingFM

     

    The parameter 'mode' defines how you count the number of layers:

      mode = 0: from maximum bottom
      mode = 1: from surface

     

    This tool can also be used to extract a single layer from a 3D dfsu file to a 2D dfsu file by defining first_layer = last_layer.
    E.g. to extract the top layer of a 3D dfsu file to a 2D dfsu file use the following setup:

     

    [DataVerticalAveragingFM]
       [INPUT]
         file_name = |volume.dfsu| 
       EndSect  // INPUT

       [OUTPUT]
         file_name = |velocity_top_layer.dfsu|
         title = 'my title'
         number_of_items = 2
         item_numbers = 2, 3
         mode = 1  
         first_layer = 1
         last_layer = 1
       EndSect  // OUTPUT

    EndSect // DataVerticalAveragingFM

     

    Alternatively you can download a compiled version of the tool DHI.MikeCore.Util from GitHub at https://github.com/DHI/MIKECore-Examples/releases.

    This tool can, among other things, extract a layer from a 3D dfsu file.

     

    Note: these executionables are not part of the official release and as such has not be subjected to extensive testing.