Author Archives: zulkarnainh

Using HEC-GeoRAS for the HEC-RAS modelling (Videos Expired!)

Note: All video tutorials have been expired!. I will make the videos to replaced expired videos soon. Sorry for the inconvenience caused. – zulkarnain

If you do HEC-RAS for the flood or water quality modeling, HEC-GeoRAS may help you. In general, HEC-GeoRAS is a plugin in ArcGIS, to help to process geospatial data from the raster image. 1) It is very helpful that allows the preparation of geometric data for import into HEC-RAS and 2) helps to display the GIS outcome, based on the outcome of HEC-RAS. This software can be download from this link.

Preparation of geometric data for import into HEC-RAS

To create the import file, the user must have an existing digital terrain model (DTM) of the river system in the ArcInfo TIN format. The user creates a series of line themes pertinent to developing geometric data for HEC-RAS. The themes created are the Stream Centerline, Flow Path Centerlines (optional), Main Channel Banks (optional), and Cross Section Cut Lines referred to as the RAS Themes.

These are the best tutorial that I obtained from youtube:

Part 1

Part 2

Part 3

Part 4

Helps to display the GIS outcome

Water surface profile data and velocity data exported from HEC-RAS simulations may be processed by HEC-GeoRAS for GIS analysis for floodplain mapping, flood damage computations, ecosystem restoration, and flood warning response and preparedness.

The tutorial to export the data from HEC-RAS to GeoRAS as follows:

Credit: Yasir A. for the good tutorials.

Field Calculator in QGIS

In QGIS, if you want to calculate the real geometries (such as area, parameter, length etc.) of polygon/point based on the current coordinate system, we need using the field calculator.  If we use this calculator, we able to show the geometries in the features table. I list a few field calculators that may interest the QGIS user as follows:

latitude and longitude

$x or $y as a variable to get the x and y

How to export string with timeperiod to .dat file? (Re-Post)

Here a question (original link) that I ask at Matlab Community that the reader may found useful.


I have a large string that containing time period such as 23-May-2009 02:00:00 (as attached). Variable editor in Matlab is unable to display these variables, since the variables have more that 524288 elements. I want to export the variables to .dat file, so I can see the list of the variables. I try to use fopen and fprintf functions to export the variables, but unsuccessful. Any help? Thank you.


load hourlyperiod.mat
d = hourlyperiod ;
fid = fopen('iwant.dat','w') ;
for i = 1:length(d)
 fprintf(fid,'%s \n',d(i,:)) ;
fclose(fid) ;

Menukar sistem koordinat menggunakan ArcGIS

Bila dapat shp files dari client dalam sistem koordinat kertau, mesti pening kepala. Mananya tidak, saya adalah pengguna QGIS dan function “on the fly” CRS transformation dalam QGIS sangat tidak membantu, berbanding function yang sama dalam ArcGIS. That why, ArcGIS sangat disukai oleh ramai orang sebab lebih muda berbanding QGIS. Tetapi, since ArcGIS perlu dibeli dan license sangat mahal, ini menyebabkan saya lebih suka menggunakan QGIS.

Berbalik kepada masalah saya, saya perlu ubah sistem koordinate kertau kepada WSG84, since default sistem QGIS adalah WSG84. Tambahan, kalau import files dari Google Earth, WSG84 akan digunakan. Dengan basic knowledge dlm QGIS dan ArcGIS yang sangat shallow, google lah cikgu saya. Saya terjumpa satu link orang Melayu yang ajar step by step macam mana hendak tukar. Saya repost balik post dia disini untuk rujukan saya dan pembaca disini.

Post beliau seperti berikut:

Di sini saya akan tunjukkan cara-cara menukar sistem koordinat tu menggunakan ArcMap. Contoh yang akan saya berikan ialah menukar data dari RSO ke WGS84.

1. Pastikan sistem koordinat sumber data

Mula-mula anda perlu pastikan apakah sistem koordinat yang digunakan oleh data yang ingin anda tukarkan sistem koordinat tu. Contohnya katalah saya ingin menukar data mukim saya ke WGS84. Saya perlu pastikan apakah sistem koordinat yg digunakan oleh mukim tu. Katakan saya tahu data mukim tu adalah data RSO,.. saya perlu pastikan pada ruangan XY Coordinate data tu tertera Kertau_RSO_Malaya_Meters dan bukannya Unknown.

Sekiranya nilai yang dipapar adalah Unknown, anda perlu define dahulu sistem koordinat pada data tu sebelum proceed langkah seterusnya. Contoh, kalau data mukim saya tu adalah data RSO, saya perlu define dahulu data tu sebagai RSO. Proses ni anda perlu buat dalam ArcCatalog ataupun Catalog Window.

Klik butang Select.. untuk define sistem koordinat sumber data
2. Set sistem koordinat untuk Data Frame.

Kemudian setkan sistem koordinat Data Frame mengikut sistem koordinat apa yang anda hendak convert. Macam contoh saya ni, saya nak convert mukim tu dari RSO ke WGS84, jadi sistem koordinat Data Frame tu saya perlu set dahulu sebagai WGS84.

3. Pastikan adakah terdapat perbezaan datum antara sistem koordinat.

Step ni agak penting juga untuk pastikan ketepatan data yang akan anda hasilkan nanti. Anda perlu tahu apakah datum yang digunakan antara sistem koordinat yang terlibat. Contohnya data mukim saya adalah RSO. RSO untuk Semenanjung menggunakan datum Kertau. WGS84 pula menggunakan datum WGS84…. bermaksud kedua-dua sistem koordinat menggunakan datum yang berbeza.

Sekiranya terdapat perbezaan datum, proses Datum Transformation perlu dilakukan. Mudah saja, klik saja butang Transformation pada dialog Data Frame Properties dan setkan transformation seperti gambar kat bawah ni.

4. Export data menjadi layer baru.

Kemudian export saja sumber data tu menjadi layer baru. Tapi jangan lupa, pastikan anda pilih option Use the same coordinate system as : the data frame. Kalau tak pilih option tu, nanti data yang dihasilkan tetap tak berubah, masih lagi sistem koordinat yang asal. Dalam contoh di bawah ni, data mukim tu saya convert menjadi shapefile dan saya namakan sebagai MukimWGS.shp.

OK …selesai sudah proses. Data mukim saya telahpun diconvert daripada RSO menjadi WGS. Secara ringkasnya, anda bolehlah rujuk gambarajah bawah ni untuk step-step yang telah saya huraikan tadi.

Writing and Defence of Research Proposal

On 23rd Dec, I have required attending the PhD deference proposal. This is my first-time experience to do the assessment. As the examiner, I also google myself to find out what criteria that examiner wants to evaluate the proposal defend. Here are some good tips that I obtained from the internet on how to writing and also defend your PhD proposal
Hints for Writing a PhD Proposal
By Angelos Keromytis (April 2010)

  • a description of the problem in enough detail to clearly state the thesis proposition (next item)
  • a proper, concise thesis proposition; this is not an abstract statement like “we’re going to investigate the insider problem”, but something along the lines of “our hypothesis is that the use of XYZ technology in environment Z under constraints Q can identify insider attackers with probability Z” — obviously, the fewer qualifiers the better, but you also need to be accurate; since this is a thesis proposal, we will cut you some slack — but it’s in your best interest to think hard about this, since it is the anchor point of your whole thesis (and the next few years’ worth of work for you)
  • a description of the related work, how it does not solve the problem, and how your hypothesis has not been tested before
  • preliminary results (if any) that indicate that you have reason to believe that the hypothesis holds
  • additional experiments that you will run to prove that the hypothesis holds
  • what you’ll need to build to run said experiments (and what you’ve already built)
  • what happens if you can’t run some of these experiments, or if they give you “bad” results — what’s your failover?
  • what are the expected contributions, keeping in mind that each major contribution must demonstrate novelty, non-triviality, and usefulness (so, “first”, “best”, “only” are good adjectives here)
  • how long you expect all this to take

Continue reading →

Example of Bootstrapping

In a statistical analysis, bootstrapping is a popular technique, especially useful when the sample size is small. It is involved with resampling and the technique is assume nothing about the distribution of our data. It is noted that a small sample (<40), we can assuming a normal or a t-distributions.

Bootstrapping can be run in many statistical software in the market. For me, I like to use SPSS, since the software has integrating bootstrapping in each analysis. Many codes that implementing bootstrapping can be found in Matlab and R-language.

The following example is how this technique works that been obtained from this source:

Example Sample

We begin with a statistical sample from a population that we know nothing about. Our goal will be a 90% confidence interval about the mean of the sample. Although other statistical techniques used to determine confidence intervals assume that we know the mean or standard deviation of our population, bootstrapping does not require anything other than the sample.

For purposes of our example, we will assume that the sample is 1, 2, 4, 4, 10.

Example – Bootstrap Sample

We now resample with replacement from our sample to form what are known as bootstrap samples. Each bootstrap sample will have a size of five, just like our original sample. Since we randomly selecting and then are replacing each value, the bootstrap samples may be different from the original sample and from each other.

For examples that we would run into in the real world we would do this resampling hundreds if not thousands of times. In what follows below, we will see an example of 20 bootstrap samples:

2, 1, 10, 4, 2
 4, 10, 10, 2, 4
 1, 4, 1, 4, 4
 4, 1, 1, 4, 10
 4, 4, 1, 4, 2
 4, 10, 10, 10, 4
 2, 4, 4, 2, 1
 2, 4, 1, 10, 4
 1, 10, 2, 10, 10
 4, 1, 10, 1, 10
 4, 4, 4, 4, 1
 1, 2, 4, 4, 2
 4, 4, 10, 10, 2
 4, 2, 1, 4, 4
 4, 4, 4, 4, 4
 4, 2, 4, 1, 1
 4, 4, 4, 2, 4
 10, 4, 1, 4, 4
 4, 2, 1, 1, 2
 10, 2, 2, 1, 1

Example – Mean

Since we are using bootstrapping to calculate a confidence interval about the population mean, we now calculate the means of each of our bootstrap samples. These means, arranged in ascending order are: 2, 2.4, 2.6, 2.6, 2.8, 3, 3, 3.2, 3.4, 3.6, 3.8, 4, 4, 4.2, 4.6, 5.2, 6, 6, 6.6, 7.6.

Example – Confidence Interval

We now obtain from our list of bootstrap sample means a confidence interval. Since we want a 90% confidence interval, we use the 95th and 5th percentiles as the endpoints of the intervals. The reason for this is that we split 100% - 90% = 10% in half so that we will have the middle 90% of all of the bootstrap sample means.

For our example above we have a confidence interval of 2.4 to 6.6.

What is the difference between Fanning and Moody friction factors?

Which is a correct equation of head loss, Equations 1 or 2?

hL = 4fLV2/2gD         (Equation 1)
hL = flv2/2gd         (Equation 2)

Equation 1 is applied Fanning equation and Equation 2 is applied Moody equation. For old books and tutorial, they like to use the Fanning equation. But, the recent books, they love to applied Moody equation. 😉

A good explanation for this issue as follows (source):

What is the difference between Fanning and Moody friction factors?

Many folks calculate 4 times greater head loss (or 4 times less) than the actual friction loss. This comes from confusion between Moody and Fanning Friction factors. Some friction factor graphs are for Moody Friction factor, which is 4 times Fanning friction factor. That is, f = 64/Re is Moody and f = 16/Re is Fanning.

Be careful with your hydraulic calcs. It is easy to mix the two and calculate 400% greater (or 25% less) head loss. The calculation for head loss in feet is:

using Moody Friction factor -
 h(friction) = f(M) * (L/D) * v^2 / (2 * g)

using Fanning Friction factor -
 h(friction) = 4*f(F) * (L/D) * v^2 / (2 * g)

 h(friction) = head loss by friction in feet
 f(M) = Moody Friction factor
 f(F) = Fanning Friction factor
 L = length in feet
 D = pipe inside diameter in feet
 v = velocity in ft/s
 g = 32.174 ft/s^2, acceleration due to gravity

The Colebrook-White equation is an iterative method that calculates Fanning friction factor.
 f(F)^2 = 1 / ( -4 * Log(eps / (3.7 * D) + 1.256 / (Re * √f(F) )

 eps = pipe roughness in feet
 Re = Reynold's number