Thursday, March 16, 2023

Research Note #28 Making A Polygon from Delimited Coordinates Text File (CSV) on QGIS

For this work, I was using QGIS 3.4.1-Madeira. The objective was to create a polygon to be used as study area for GEE analysis later. The study area will contain of several districts in state of Punjab, India. The study area itself is constructed from burnt area validation points over Punjab. 

I. Load the validation points coordinates from delimited text file.

  1. From 'Layer' menu, select 'Add Layer' --> 'Add Delimited Text Layer'
  2. In dialog box, select the delimited text file in the 'File name' section. 
  3. In 'Geometry Definition' section, particularly in 'Point coordinates', select the X (longitude) and Y (Latitude) fields. 
  4. Make the first row as the field names in the 'Record and Fields Options' section by ticking 'First record has field names'.
  5. Check again all entries, then click 'Add'. If it's OK, new layer containing all points from the delimited file will be added.
Validation points loaded on the map


II. Add the Punjab map layer
  1. Load the Punjab districts shape file by double clicking the SHP file on the Layer explorer.
  2. Double click the Punjab district layer. In the Layer Properties dialog bog, select 'Setting' and click on 'Query Builder' in the 'Provider Feature Filter'. This is done to filter the districts so only the one covered by validation points will be shown on the map.
  3. In Query builder insert this filter string:  "dtname" = 'Ludhiana' OR "dtname"='Amritsar' OR "dtname" = 'Moga' OR "dtname" = 'Malerkotla' OR "dtname" = 'Sangrur' OR "dtname" = 'Firozpur', then click OK.
  4. If it's correctly done, the map will include the selected districts only.
Query builder dialog box

The districts consisting validation points in Punjab


III. Create study area polygon from the validation points.
  1. From menu 'Processing', select 'Toolbox'. Then, in the Processing Toolbox explorer, select 'Vector Geometry' --> 'Concave hull (alpha shapes)'.
  2. In the Concave hull dialog box, make sure that the input layer is the coordinates layer previously generated. Let just use default values (0.3 threshold) and click 'Run'.
  3. If it's done correctly, a new polygon covering the validation points will be generated.
  4. This layer could be exported into SHP file and uploaded to GEE for data processing.
Concave Hull (Alpha shapes) dialog box


New polygons are shown as areas in hashed lines on the map

Tuesday, January 28, 2020

Gunpla #59 - HG Gundam G40 - Industrial Design Ver. Review



OK, this one was truly different from any other kits I've ever built since I started the hobby 7 years ago. The G40 was unique in every way possible: the name, the package, the assembly, the aesthetics, the articulation, the price tag, everything. From the first glance, it's obvious that this is the iconic RX-78-2 Gundam from UC timeline, and yet, the package didn't show any model number nor timeline like a HG normally does (e.g. HGUC), and no box art, just a black box with an big embossed silver 'G40' letters printed on it. Furthermore, the price tag of 3300 yen made everybody scratched their head. Just why did a HG kit become so ridiculously expensive? Interestingly, while it should be released as a regular retail kit, but for some reason, it was sold in very limited number at stores. It looked like Bandai didn't have much confidence to sell it as a regular retail kit.


Since the first time it was announced, G40 has drawn controversy among gunpla fans across the globe. Some people praises the brand new design and articulation, while the others despised its aesthetics and price tag. Tell the truth, I was among the people who hated it in the beginning. Anyway, after learning more details and building the kit, my respect gradually became stronger towards it. 



Many gunpla fans considered the design of G40 as 'ugly', especially with the curved aesthetics instead of blocky one as conventional RX mobile suit series. Anyway, the most controversial part of this kit was definitely the joints, particularly the hip joints. Due to fixed skirts of the kit, it utilized very unusual 'dropped' hip joints, which made G40 look so weird. The kit looked as it had a broken thigh. Anyway, there were big reasons behind this design. As I dug deeper into its design, I finally grasped the true concept of the design: G40 was the form of Gundam in case it's produced in real life. Surely, it betrayed the real-robot genre images many people cherish, but that 'broken thighs' are very reasonable in many real-life robot designs.




On the other hand, if there's aspects this kit excels at, then it should be the articulation. Never in my life, I've ever seen a kit so articulated as G40. It just could do any poses, from a cool poses to a absurd and ridiculous one. And while the price tag seemed so much expensive for a HG kit, the special artbook which came with it was truly worth it. 

You may love it or even hate it, but with the features came with the kit IMHO, G40 was one of the best HG of 2019.

------------------------

HG Gundam G40 Industrial Design Ver.

Pros:
  • The most insane articulation of gunpla you've ever seen.
  • The artbook was really nice bonus (I recommend you to read it before building the kit)
Cons:
  • Hip joints look really weird
  • Pretty expensive for a HG kit

Monday, January 27, 2020

Gunpla #58 - P-Bandai HGUC Gundam TR-6 Haze'n-thley II Review



Since I have made a review for this kit on Youtube, I will just summarize some important things and post some nice pictures of it in this post. I understood that AoZ aesthetics and designs may not be for everyone, but IMHO, this kit was one of the best HG kits of 2019. Firstly, it's huge, and it's even taller than HGUC Fenelope, the biggest HG kit of last year. Second, it has interesting features and gimmicks, in particular with the transformation. Since it has two modes of transformation, you basically got three kits in one package: MS mode, top/bottom fighter mode and MA mode. Finally, similar with previously released AoZ kits in HG line, the Hazen'thley II is fully customizable, which means the kit could be easily kitbashed with the others from the same line. You got all these features with price tag less than 5000 Yen (original price), which is a good deal for such gigantic HG kit IMHO. There were of course downside of it, such as the lack of articulation on the torso and legs, complicated transformation, and mediocre marking stickers.

Mobile Suit Mode:

Rifle Mode



Crow Mode
Top Fighter and Bottom Fighter Mode



Mobile Armor Mode


Mobile Suit Mode with Hrududu II + Gundam TR-6 Hazel II ("Pseudo" Haze'n-thley II Rah)



Configuration with two Hrududu IIs

Mobile Armor Mode with Hrududu II + Gundam TR-6 Hazel II



Size Comparison

vs HGUC Second V (left) and MG RX-78-02 Gundam the Origin (right)

vs HGUC Delta Plus, Zeta Plus A1 and Zeta Plus C1


-----------------

RX-124 Gundam TR-6 Haze'n-thley II

Pros:
  • Wicked design, arguably the best of AoZ series by far
  • Two modes of transformation
  • Good price tag
  • Highly customizable for kitbash
Cons:
  • Complicated transformation with lots of part-forming stuffs
  • Lack articulation of the torso and legs
  • Mediocre marking stickers

Tuesday, January 7, 2020

Research Note #26 - Filtering Data and Making Standard Deviation using Google Earth Engine

So, there are two main objectives of this script: display data based on a certain threshold value (in this case, reflectance < 1000) and make a standard deviation from the results. The Data used in this example was Sentinel-2 MSI Level 2A, in the period between November 1 - 15, 2019. Cloud masking was utilized at the beginning of the script to choose granules which were clear from clouds.

// Create a geometry representing the analysis region.
var daerah = ee.Geometry.Rectangle([72.611536, 28.354144, 78.807625, 32.630466]); 

/**
 * Function to mask clouds using the Sentinel-2 QA band
 * @param {ee.Image} image Sentinel-2 image
 * @return {ee.Image} cloud masked Sentinel-2 image
 */
function maskS2clouds(image) {
  var qa = image.select('QA60');

  // Bits 10 and 11 are clouds and cirrus, respectively.
  var cloudBitMask = 1 << 10;
  var cirrusBitMask = 1 << 11;

  // Both flags should be set to zero, indicating clear conditions.
  var mask = qa.bitwiseAnd(cloudBitMask).eq(0)
      .and(qa.bitwiseAnd(cirrusBitMask).eq(0)

 // Choose pixels with reflectance < 1000
      .and(image.lt(1000))
      );

  return image.updateMask(mask).divide(10000);
}

// Map the function over the analysis region and period
// Load Sentinel-2 TOA reflectance data.
var datasentinel = ee.ImageCollection('COPERNICUS/S2')
                  .filterDate('2019-11-01', '2019-11-15')
                  .filterBounds(daerah)
                  // Pre-filter to get less cloudy granules.
                  .filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20))
                  .map(maskS2clouds)
                  ;

// Get the standard Deviation.
var hasil = datasentinel.reduce(ee.Reducer.stdDev());

// Define the plot parameter, use the standard deviation of Band 4 only  
var stdevVis = {
  min: 0,
  max: 0.005,
  bands: ['B4_stdDev'],
  palette: ['0000FF', '00FFFF', '00FF00', 'FFFF00', 'FF0000']
};

// Add the plot layer on the map
Map.addLayer(hasil, stdevVis, 'Std Deviation');
Map.setCenter(75.7095805, 30.492305, 14);

And the result will be like this:


You may seen some pixels with very high standard deviation values (shown in red, cyan or anything else other than blue). To 'clean-up' these pixels, we can add another filter to the standard deviation results. For example to show the values no higher than 0.000001:

// Get the standard Deviation.
var hasil = datasentinel.reduce(ee.Reducer.stdDev());
var hi_stddev = hasil.lt(0.000001);
var hasil = hasil.updateMask(hi_stddev);

The result will be like this:


Finally, we can overlay the base Google Map using the result by choosing the Satellite map (button on the right corner of the map).


Friday, November 22, 2019

Gunpla #57 - P-Bandai HGUC RX-78-6 Gundam G06 [Mudrock] Review


Finally, the Gundam G06 a.k.a. Mudrock receives its HGUC treatment. Tell the truth, I was a little bit underestimating this kit because of  'unconvincing' pictures shown by the promo images when Bandai announced it few months ago. After completing the build however, I should revised my skeptical thoughts, because ... this kit is truly amazing!


First things first, the Mudrock came with 100% new parts. Yep, 11 runners, 2 sheets of stickers and 100% new molds, no reused runners from previously released kits. This alone makes the Mudrock on the same league with other 'original' pbandai kits such as Pale Rider, Gundam TR-6 Woundwort and Gundam Pixie. 

The Mudrock itself looks so quite different from most of its kind in UC timeline. In contrary with other RX-78 Gundam series, it doesn't have slits on the face plate. Also, with those giant cannons on the backpack, it looks more like a hybrid between gundam and guncannon. Moreover, the Mudrock bears a striking resemblance to Duel Gundam from MS Gundam Seed, especially with the green eyes. That's also the main reason I choose red eyes for the build, to distinguish it from the Duel Gundam. 


Did I said there are red eyes and green eyes? Yes, you get two colors of eye stickers. The sticker sheet itself is very minimal as it only contained the two eyes, two sensors and 'V' insignia of the gundam. Again, unlike any other HGs, this kit doesn't use stickers for color separation at all! However, of course, there were still parts which needed to be painted in order to match the color correctly, such as the thrusters on the backpack, crotch and legs. 

Anyway, the main feature of this kit is the ability to switch between the complete and incomplete version of Mudrock. For that purpose, you get two versions of shoulders and calves, and you can switch them easily. That's a really big bonus given by Bandai this time. No matter which version you choose, both are aesthetically awesome.


Another interesting feature is articulation of the forearms, which could twist in 360 degree. This was made possible by the use of special polycaps connected to the double jointed elbow, and it makes the arms having much wider range of moves compared to ordinary HG kits. This was the second time I saw this kind of feature after HGUC Gundam TR-6 Haze'n-thley II which was released last month. The articulation of legs are pretty much similar with HGUC Gundam Revived because they used similar joints system. The shoulders and torso, on the other hand, only use ordinary ball joints with few degrees of articulation. This, however, didn't prevent me to make various cool poses at all, because in general, the kit was solid and the articulation was really good. 

This kit came with a pair of clench hand for holding the beam sabers and one trigger right hand for the beam rifle. And as usual, you also got a pair of beam effect parts for the sabers. Finally, there's a sheet of marking sticker to add some details to the kit.

The verdict, as I mentioned before, this kit was amazing! 100% new parts, the ability to easily switch between the complete and incomplete version, the minimal use of foil stickers and  special articulation of the forearms in one HG kit, with a fair 2200 Yen price tag. The only downside I found were the lacks of hands and the use of ball joints for torso and shoulders. Should you buy it? Yes, I really recommend it! 

--------------

RX-78-6 Gundam G06 [Mudrock]

Pros:
  • Uses 100% new parts
  • Could easily switch between Complete version and Incomplete one.
  • Minimal use of foil sticker
  • The forearms have special articulation which enables them to twist 360 degree.
  • 2200 Yen price tag, for every thing mentioned above.
Cons:
  • Still use ball joints on the torso and shoulders
  • Lacks hands, especially the opened one.

Wednesday, November 6, 2019

Research Note #25 - Reading a Text File Line-by-Line with Fortran

Again, this is actually a very simple task which I usually deal with ... and forget, most of the time! That's why this post exists. The following is a basic Fortran code to enable you reading the contents of a text file, line-by-line. 

As an example, let's make a text file (named 'list.txt') containing a list of files with their complete paths on Linux:

$ ls ../gcom-c/aerosol/0524/pl/* > list.txt
$ cat list.txt

../gcom-c/aerosol/0524/pl/GC1SG1_20190901D01D_T0524_L2SG_ARPLK_1001.h5
../gcom-c/aerosol/0524/pl/GC1SG1_20190902D01D_T0524_L2SG_ARPLK_1001.h5
../gcom-c/aerosol/0524/pl/GC1SG1_20190903D01D_T0524_L2SG_ARPLK_1001.h5
../gcom-c/aerosol/0524/pl/GC1SG1_20190904D01D_T0524_L2SG_ARPLK_1001.h5

Now, this is the Fortran code to read file 'list.txt':

PROGRAM READTEXT
IMPLICIT NONE
CHARACTER(LEN=8) :: listfile
CHARACTER(LEN=70) :: filecontents
INTEGER :: io

listfile="list.txt"

OPEN(10, FILE=listfile, FORM="FORMATTED", STATUS="OLD",&
        ACTION="READ")

DO
   READ(10,"(A70)",IOSTAT=io) filecontents
   IF (io/=0) EXIT
   PRINT *, filecontents
END DO
CLOSE(10)

END PROGRAM READTEXT

How it works?

The program will open file 'list.txt', then read the first line of the file and put the (string) contents into variable 'filecontents'. It will then print the contents of variable onto the screen. Since there's a DO.. END DO statement, this process will repeat, with the next line being read, replacing the contents of variable 'filecontents'. This looping process will end once there are no more lines found in the file, invoking IOSTAT to a value other than 0 (0 means no I/O error occurred, other values mean there are I/O errors), then program will exit. That's all!

Some important notices:
  • The absence of 'DO ... END DO' will make the program only reads the first line of the file.
  • The absence of 'IF (io/=0) EXIT' will make the program runs endlessly, with the last line of the file kept being showed on the screen.
  • If the output format is not determined (for example, FMT=* instead of A70), the program will not correctly show the file's contents. The (character) length of this format should be same or more than the one at variable declaration. Why 70? Because in this case, the full path of file list (in one line) has 70 characters.