Author Archives: zulkarnainh

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.


Question:

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.

Answer:

load hourlyperiod.mat
d = hourlyperiod ;
fid = fopen('iwant.dat','w') ;
for i = 1:length(d)
 fprintf(fid,'%s \n',d(i,:)) ;
end
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.

Kredit:www.sukagis.com

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)

where,
 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) )

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

Cheap printing dissertation services in Melaka

Cheap printing dissertation services in Melaka

I want to promote a good shop for printing a dissertation/thesis service in Melaka. Each paper, cost only 5sen (more than 100papers) and photostat is around 4sen. Very cheap, it is?

The shop near to Multimemedia University (MMU) Melaka, Bukit Beruang. Below are detailed and some picture of the shop:

Address of the shop: 

No.13 Jalan Bukit Beruang Utama 2, Taman Bukit Beruang Utama 75450
Melaka, Malaysia
016-710 0050

Picture of the front shop and their rate of services:

12033185_508554862653159_8606001636575672581_n 12036768_508554882653157_4575379643839928874_n

Printing murah utk thesis di Melaka

Saya ingin berkongsi mengenai kedai murah untuk print thesis di kawasan Melaka. Setiap helai, harga hanya 5sen (lebih 100 kertas) dan fotokopi hanya 4sen. Murah bukan?

Kedai ini berhampiran dengan Universiti Multimedia (MMU) Melaka di Bukit Beruang. Berikut adalah huraian dan gambar mengenai kedai berkenaan:

Note: Have a cheap printing shop around Melaka? Please share with me. 😉