Welcome to the RAS Solution Forums HECRAS Controller Obtain array of Station/Elevation for a cross section in RAS Controller

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #8216
    Anonymous
    Guest

    Hi Chris,
    I am looking for a method obtaining any array or string of Station values and their corresponding ground elevation for a give cross-section (of a river/reach).
    I searched in the user guide of Automating HEC-RAS but could not get.

    Alternatively, I tried parsing the *.g01 (Geometry file) but it can complicate things when we have 10 km long cross-sections.

    I would like to know if there is any method (or can be built) in using RAS controller methods.

    Thanks
    Anand K

    #13589
    Chris G.
    Keymaster

    Return-Path: Received: from compute1.internal (compute1.nyi.internal [10.202.2.41])
    by sloti1d2t14 (Cyrus 3.1.3-613-gc72981f-fastmail) with LMTPA;
    Wed, 23 May 2018 10:02:50 -0400
    X-Cyrus-Session-Id: sloti1d2t14-3011811-1527084170-2-11151381107641156784
    X-Sieve: CMU Sieve 3.0
    X-Spam-known-sender: no
    X-Spam-score: 0.0
    X-Spam-hits: BAYES_00 -1.9, FREEMAIL_FROM 0.001, HTML_MESSAGE 0.001,
    RCVD_IN_DNSWL_NONE -0.0001, RCVD_IN_MSPIKE_H3 -0.01,
    RCVD_IN_MSPIKE_WL -0.01, SPF_PASS -0.001, URI_HEX 1.122, LANGUAGES en,
    BAYES_USED global_overload, SA_VERSION 3.4.0
    X-Spam-source: IP=’74.125.82.180′, Host=’mail-ot0-f180.google.com’, Country=’US’,
    FromHeader=’com’, MailFrom=’com’
    X-Spam-charsets: plain=’us-ascii’, html=’utf-8′
    X-Resolved-to: [email protected]
    X-Delivered-to: [email protected]
    X-Mail-from: [email protected]
    Received: from mx3 ([10.202.2.202])
    by compute1.internal (LMTPProxy); Wed, 23 May 2018 10:02:50 -0400
    Received: from mx3.messagingengine.com (localhost [127.0.0.1])
    by mailmx.nyi.internal (Postfix) with ESMTP id CBEB44613B
    for ; Wed, 23 May 2018 10:02:49 -0400 (EDT)
    Received: from mx3.messagingengine.com (localhost [127.0.0.1])
    by mx3.messagingengine.com (Authentication Milter) with ESMTP
    id F07031FFD28;
    Wed, 23 May 2018 10:02:49 -0400
    ARC-Seal: i=1; a=rsa-sha256; cv=none; d=messagingengine.com; s=fm2; t=
    1527084169; b=eIz0mbJDwYAyBs2j90ZyFwGr1eLFZ0p4EkmooTWvHMASNP9HIg
    orzoBTTkFaSmQ06YUUhMsPxsquNIoPNrfBtCQTIVMPu9vLBfd8p/cqix91T/gf6R
    eruA/JkqzhK8g+9c6GzafaiWcZZKpQFMGyznpvn/GEyGSw7nLjHeg+aG+YxPnBjj
    +PIt+AKdx37dEORC5vDDjb4v1zJWTR7ynjB896PEN51OhvMMrdgcF/mOK78zAE39
    nUefSeU1uTupWG2lOoDQVHq7YTDkMofiNvo0vK+gc0jRh331PwoRbyJOsZuRND82
    sTENaBjL91LnOsY23PpAt3OZxonlaBsD9Uvg==
    ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=
    messagingengine.com; h=from:content-type
    :content-transfer-encoding:mime-version:date:subject:message-id
    :references:in-reply-to:to; s=fm2; t=1527084169; bh=AiRRL0S7VBKR
    EpwxrsKUgKvE8mCIUGPZR9X7OaJ/g1s=; b=LuhlGwefYfoW9i7aji+w8yEj9K24
    xc2TaWRprYy2Z2UyyuuXKxn1kUy7On84QNYks7A4SBrjxCf1ZsLpf5hP/j7l2QUj
    GUa3IuJ06/cs6Jga4djFw7CfusP2kwYKupAb/ocVrXL+9XPVFMbAZq3SAi/KdiyR
    GS9I3JbNdiecBDS+Q+Z0b/LGVBQdTYZ4eByXC+gDFJYgFIgn/SB78ppiPnOt9y2m
    t8l1BO4GovRqOPslgVwVIBUN9KC4rDWDDAB9vNjH8sUGN9pV/uKJ6WIYUpBDsxAW
    KxGf4f+hYsbebFL54KTSYoAHywzneOHhlotlksGauiCpdO/ZimsaUmXSwg==
    ARC-Authentication-Results: i=1; mx3.messagingengine.com; arc=none (no signatures found);
    dkim=pass (2048-bit rsa key sha256) header.d=gmail.com
    [email protected] header.b=EAsKirXh x-bits=2048 x-keytype=rsa
    x-algorithm=sha256 x-selector=20161025;
    dmarc=pass (p=none,d=none) header.from=gmail.com;
    iprev=pass policy.iprev=74.125.82.180 (mail-ot0-f180.google.com);
    spf=pass [email protected]
    smtp.helo=mail-ot0-f180.google.com;
    x-aligned-from=pass (Address match);
    x-cm=none score=0;
    x-google-dkim=pass (2048-bit rsa key) header.d=1e100.net
    [email protected] header.b=SsGbf6hi;
    x-ptr=pass x-ptr-helo=mail-ot0-f180.google.com
    x-ptr-lookup=mail-ot0-f180.google.com;
    x-return-mx=pass smtp.domain=gmail.com smtp.result=pass
    smtp_is_org_domain=yes header.domain=gmail.com header.result=pass
    header_is_org_domain=yes;
    x-tls=pass version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256
    bits=128/128;
    x-vs=clean score=0 state=0
    Authentication-Results: mx3.messagingengine.com;
    arc=none (no signatures found);
    dkim=pass (2048-bit rsa key sha256) header.d=gmail.com
    [email protected] header.b=EAsKirXh x-bits=2048 x-keytype=rsa
    x-algorithm=sha256 x-selector=20161025;
    dmarc=pass (p=none,d=none) header.from=gmail.com;
    iprev=pass policy.iprev=74.125.82.180 (mail-ot0-f180.google.com);
    spf=pass [email protected]
    smtp.helo=mail-ot0-f180.google.com;
    x-aligned-from=pass (Address match);
    x-cm=none score=0;
    x-google-dkim=pass (2048-bit rsa key) header.d=1e100.net
    [email protected] header.b=SsGbf6hi;
    x-ptr=pass x-ptr-helo=mail-ot0-f180.google.com
    x-ptr-lookup=mail-ot0-f180.google.com;
    x-return-mx=pass smtp.domain=gmail.com smtp.result=pass
    smtp_is_org_domain=yes header.domain=gmail.com header.result=pass
    header_is_org_domain=yes;
    x-tls=pass version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256
    bits=128/128;
    x-vs=clean score=0 state=0
    X-ME-VSCategory: clean
    X-CM-Envelope: MS4wfFZ2mce3fHMWO3ZDxYVFN7dNDVGaCrUcJ99jNXBdvqX6KvXf26axuW/lKQg1drRGwklXiCMo7vKDIQGfJlAujlY1apWx66q+TCqb1VN1YFR08eQIhwFK
    9CMDe2eF/fvBi6L9Ua73RAqu51OEJiFREDbGFLDYmKSY0o4A6G12jD/Y4mdSY9pIGSPAsdmHwyLKfN9bysSvUq+yLfHwnmmqm+AZgy/SZHdnkxisiyJcRoQy
    X-CM-Analysis: v=2.3 cv=Tq3Iegfh c=1 sm=1 tr=0 a=n1rw/PkT84WRM9ouvbmWDg==:117
    a=x7bEGLp0ZPQA:10 a=po3G2Dre0K0A:10 a=xqWC_Br6kY4A:10 a=4_-BN3WEXhEA:10
    a=VUJBJC2UJ8kA:10 a=9I5xiGouAAAA:8 a=XhIHRxTSgjuO5fjFPuwA:9 a=CjuIK1q_8ugA:10
    a=lg4JEFhukzMA:10 a=oDNnbiFrkEAA:10 a=zCR6bkHU8wMpuEBengMA:9
    a=L2FrC6hrkbKzbLGn:21 a=_W_S_7VecoQA:10 a=QEXdDO2ut3YA:10
    a=ARFN2YZ7Uv8kHtb7LS-q:22
    X-ME-CMScore: 0
    X-ME-CMCategory: none
    Received-SPF: pass
    (gmail.com … _spf.google.com: Sender is authorized to use ‘[email protected]’ in ‘mfrom’ identity (mechanism ‘include:_netblocks.google.com’ matched))
    receiver=mx3.messagingengine.com;
    identity=mailfrom;
    envelope-from=”[email protected]”;
    helo=mail-ot0-f180.google.com;
    client-ip=74.125.82.180
    Received: from mail-ot0-f180.google.com (mail-ot0-f180.google.com [74.125.82.180])
    (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
    (No client certificate requested)
    by mx3.messagingengine.com (Postfix) with ESMTPS
    for ; Wed, 23 May 2018 10:02:49 -0400 (EDT)
    Received: by mail-ot0-f180.google.com with SMTP id 77-v6so25324415otd.4
    for ; Wed, 23 May 2018 07:02:49 -0700 (PDT)
    DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
    d=gmail.com; s=20161025;
    h=from:content-transfer-encoding:mime-version:date:subject:message-id
    :references:in-reply-to:to;
    bh=AiRRL0S7VBKREpwxrsKUgKvE8mCIUGPZR9X7OaJ/g1s=;
    b=EAsKirXhjcFay/zmONS/W3+cyuSUDVpGUffQiKwgKkaBhyLAXs45hO9apK4ynHSWfY
    1J0MCBp6qurL4cTYPOoBjThWboBwiBMKjEdkmL01eoeKI70TnD5/ZhcWSVSywgHk39Bo
    b/2F1+r9L5Hl5SpGD/RFfYaZEpjEKFOfEGL0k2V5NFLLRXr8rzy1kZdZnDPR9a/HSs0W
    D56daWJlX3Cx5C1nsbfFDPUPMRz+wgTCYLtGfL/gIWUc4tyQGMJ8BNy9qScGEzHVKBSg
    RTMq1xcg8mLTwxPDkRPE4BhJzOrAF1OcWqXIKuFhzt/k0irIiNHVUCFEN0MVIQp7YYTL
    9MXw==
    X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
    d=1e100.net; s=20161025;
    h=x-gm-message-state:from:content-transfer-encoding:mime-version:date
    :subject:message-id:references:in-reply-to:to;
    bh=AiRRL0S7VBKREpwxrsKUgKvE8mCIUGPZR9X7OaJ/g1s=;
    b=SsGbf6hiFCw4G/fKQsJ/bXILr9IGHsOPyFsWnCxOna/LNWkaUw7GtJCM/y/pCHPVNL
    NZaZDTWgSJL9THgyd3kHHegmgVAYEEk7N+kawkOtITGOa2+5fjVJ+qgL3iFzLoR4/oZ1
    lUtjJNRCbHlm9vDOhs/hJWdtDA6LmQHXusgVRG65EC2dfeYrlRutSIfH7gLu14Sg2Ryu
    o0mxHyb75h4QF6rAv9cXawvZ5vhXje71Dlg9YWQI1LJcq/zWWXq1Myx0ZjJr8XuN6j4g
    4CzEPB17qpBmEAUiW5Jc78/H1W3Z/ZDIKdcxiJmOThfxmevHRarINkT7uHVeI8mrblXX
    Ph6g==
    X-Gm-Message-State: ALKqPwepSOifQGUFwfwpvQgODedJpaSbt8TCd8qWamlKFtbhtW6VrttA
    gt2fDez6n8UbeIjWTYGsmPzBGDY0
    X-Google-Smtp-Source: AB8JxZrab8jMRvTy7orjiE63wKkaVx7hPLouCIGobTLAhSAA4aztV5Ip260VdZzMiGJvWGrc32fkVg==
    X-Received: by 2002:a9d:250c:: with SMTP id k12-v6mr1912686otb.362.1527084167300;
    Wed, 23 May 2018 07:02:47 -0700 (PDT)
    Received: from ?IPv6:2607:fb90:5c46:4bfc:5dfb:d3b5:5d41:e079? ([2607:fb90:5c46:4bfc:5dfb:d3b5:5d41:e079])
    by smtp.gmail.com with ESMTPSA id c2-v6sm10560468oia.15.2018.05.23.07.02.45
    for
    (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
    Wed, 23 May 2018 07:02:46 -0700 (PDT)
    From: The RAS Solution Content-Type: multipart/alternative;
    boundary=Apple-Mail-33BC90A1-6E34-4FFF-A686-38F74F7B7E0E
    Content-Transfer-Encoding: 7bit
    Mime-Version: 1.0 (1.0)
    Date: Wed, 23 May 2018 09:02:45 -0500
    Subject: Re: Obtain array of Station/Elevation for a cross section in RAS Controller
    Message-Id:
    References: <[email protected]>
    In-Reply-To: <[email protected]>
    To: “Anand Kulkarni [via HEC-RAS Help]”
    X-Mailer: iPhone Mail (15E302)

    –Apple-Mail-33BC90A1-6E34-4FFF-A686-38F74F7B7E0E
    Content-Type: text/plain;
    charset=us-ascii
    Content-Transfer-Encoding: quoted-printable

    Hi Amanda, Unfortunately, parsing the g01 file is the only way to do this.=20=

    Chris

    Sent from my iPhone

    > On May 23, 2018, at 12:15 AM, Anand Kulkarni [via HEC-RAS Help] wrote:
    >=20
    > Hi Chris,=20
    > I am looking for a method obtaining any array or string of Station values a=
    nd their corresponding ground elevation for a give cross-section (of a river=
    /reach).=20
    > I searched in the user guide of Automating HEC-RAS but could not get.=20
    >=20
    > Alternatively, I tried parsing the *.g01 (Geometry file) but it can compli=
    cate things when we have 10 km long cross-sections.=20
    >=20
    > I would like to know if there is any method (or can be built) in using RAS=
    controller methods.=20
    >=20
    > Thanks=20
    > Anand K =20
    >=20
    > If you reply to this email, your message will be added to the discussion b=
    elow:
    > http://hec-ras-help.1091112.n5.nabble.com/Obtain-array-of-Station-Elevatio=
    n-for-a-cross-section-in-RAS-Controller-tp5655.html
    > To start a new topic under HECRAS Controller, email ml+s1091112n1184h88@n5=
    .nabble.com=20
    > To unsubscribe from HECRAS Controller, click here.
    > NAML

    –Apple-Mail-33BC90A1-6E34-4FFF-A686-38F74F7B7E0E
    Content-Type: text/html;
    charset=utf-8
    Content-Transfer-Encoding: 7bit

    Hi Amanda, Unfortunately, parsing the g01 file is the only way to do this. 

    Chris

    Sent from my iPhone
    On May 23, 2018, at 12:15 AM, Anand Kulkarni [via HEC-RAS Help] <[email protected]> wrote:

    Hi Chris,

    I am looking for a method obtaining any array or string of Station values and their corresponding ground elevation for a give cross-section (of a river/reach).

    I searched in the user guide of Automating HEC-RAS but could not get.

    Alternatively, I tried parsing the *.g01 (Geometry file) but it can complicate things when we have 10 km long cross-sections.

    I would like to know if there is any method (or can be built) in using RAS controller methods.

    Thanks

    Anand K  


    To start a new topic under HECRAS Controller, email [email protected]
    To unsubscribe from HECRAS Controller, click here.
    NAML


    –Apple-Mail-33BC90A1-6E34-4FFF-A686-38F74F7B7E0E–

    #13590
    Toby
    Participant

    Hi,

    You can accomplish this by using the .g01.hdf or .p01.hdf file.

    Here is an R script to get you started. This works in 5.0.3. You would need to update a line or two to get it to work in 5.0.4.

    cheers,

    ################################################

    # To access HDF5 files in R, we will use the rhdf5 library which is part of the
    #Bioconductor suite of R libraries.

    #install rhdf5 package
    #source(“http://bioconductor.org/biocLite.R&#8221;)
    #biocLite(“rhdf5”)

    # load libraries
    library(raster)
    library(rhdf5)
    library(rgdal)
    library(sp)
    library(maptools)
    library(rgeos)

    # #####################################################################################################
    # # Cross-section compairson
    #
    # # set working directory
    # setwd(“C:\\Users\\yourComp\\Documents\\myRAS”)
    #
    # # define the file name as an object
    # plan<-"model.g01.hdf" # # proj 4 string - look to http://www.spatialreference.org
    # sp.Ref<- "+proj=lcc +lat_1=38.33333333333334 +lat_2=39.83333333333334 +lat_0=37.66666666666666 +lon_0=-122 # +x_0=2000000 +y_0=500000.0000000001 +datum=NAD83 +units=us-ft +no_defs +ellps=GRS80 +towgs84=0,0,0" # # ##################################################################################################### # # Use of function... # # ras.data<-RAS_XS_to_R(plan, SP.Ref=NULL) # # #Unpack xs data # xs_lines<-ras.data[[1]] # # #Unpack profile data # profile<-ras.data[[2]] # ##################################################################################################### #function RAS_XS_to_R<-function(plan, sp.Ref=NULL){ ##################################################################################################### #Extract xs metadata path<-"Geometry/Cross Sections/River Names" riverNames <- t(h5read(plan, path)) #trim trailing whitespace riverNames<-sub("\\s+$", "", riverNames) path<-"Geometry/Cross Sections/Reach Names" reachNames <- t(h5read(plan, path)) #trim trailing whitespace reachNames<-sub("\\s+$", "", reachNames) path<-"Geometry/Cross Sections/River Stations" riverStations <- t(h5read(plan, path)) #trim trailing whitespace riverStations<-sub("\\s+$", "", riverStations) path<-"Geometry/Cross Sections/Node Descriptions" nodeDesc <- t(h5read(plan, path)) #remove \r\n nodeDesc<-as.character(gsub("\r\n"," ",nodeDesc)) # create reach names xsNames<-paste0(riverNames," ",reachNames," ",riverStations) #find the River channel reach lengths path<-"Geometry/Cross Sections/Lengths" reachLengths <- t(h5read(plan, path)) ##################################################################################################### # Get geometry # get xs point count path<-"Geometry/Cross Sections/Polyline Parts" xs.parts <- h5read(plan, path) xs.parts.sum<-cumsum(xs.parts[2,]) # get xs coords path<-"Geometry/Cross Sections/Polyline Points" xs.points <- t(h5read(plan, path)) nrow(xs.points) ##################################################################################################### #Create XS lines tmp<-xs.points[1:xs.parts.sum[1],] xs_lines<-SpatialLines(list(Lines(list(Line(tmp)), ID = "1"))) for(i in 2:length(xs.parts.sum)){ tmp<-xs.points[(xs.parts.sum[i-1]+1):xs.parts.sum[i],] L.tmp <- SpatialLines(list(Lines(list(Line(tmp)), ID = as.character(i)))) xs_lines <- spRbind(xs_lines, L.tmp) }# close i loop #create the spatial lines xs_lines<-SpatialLinesDataFrame(xs_lines, data.frame(xsNames=xsNames,rivNames=t(riverNames),reaNames=t(reachNames), rivSta=t(riverStations),Desc=nodeDesc,ReachLen=reachLengths)) # Assign the sp ref if provided if(!is.null(sp.Ref)){ crs(xs_lines)<-sp.Ref } ##################################################################################################### # get cross section station and elevation data from RAS path<-"Geometry/Cross Sections/Station Elevation Info" eleInfo <- t(h5read(plan, path)) path<-"Geometry/Cross Sections/Station Elevation Values" eleValue <- t(h5read(plan, path)) # convert profile values to dataframe profile<-data.frame(station=eleValue[,1], elev=eleValue[,2]) # assign each profile an id profile$id<-NA for(i in 1:nrow(eleInfo)){ startID<-eleInfo[i,1] endID<-startID + eleInfo[i,2] profile$id[(startID+1):endID]<-i }#close i loop # give profile names ids xsNames<-data.frame(id=1:length(xsNames), names=xsNames) profile$xsName<-xsNames[match(profile$id,xsNames$id),"names"] # xs stationing may not start at zero!!! # correct for xs which do not start at 1 for(i in 1:length(unique(profile$id))){ index<-which(profile$id==i) if(profile[index,1][1]!=0){profile[index,1]<-profile[index,1]-profile[index,1][1]} }# close i loop return(list(xs_lines, profile)) }# close function

    #13591
    PaoloP
    Participant

    Hi Anand,

    you can download from http://www.m3eweb.it/products/ the App RAS to Excel and than copy part of the program that gets stations/elevations from .gxx file.

    PaoloP

    #13592
    Anonymous
    Guest

    Hi all,
    Thanks for the reply that is encouraging. I will try out the methods.

    Regards,
    Anand K

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.