displaying an image in polar projectionthe bilko formula latlon_grid_map_hires2.frm is designed to...

6
LearnEO! Bilko Tutorial T11.7 www.learn-eo.org/tutorial/ Displaying an image in polar projection This tutorial sheet assumes that you already know how to display MERIS level 1 data as colour composite images. If not, download and try T2.4 Displaying MERIS data as a colour composite; this uses the same MERIS image and explains how to create true colour composites. Required resources MER_FR__1PNEPA20080812_095210_~.N1 - Envisat MERIS Full Resolution Level 1 data from the Barents Sea. Tools for the tutorial: o arctic_coastline_67-90n_0-60e.dat.bz2 - coastline data in USGS Mapgen format from the NOAA National Geophysical Data Centre (NGDC) Coastline Extractor. o Formulas: latlon_grid_map_hires2.frm and rgb_coastline_grid.frm Detailed instructions Open the MERIS image MER_FR__1PNEPA20080812_095210_~.N1 and create a colour composite. Give the image an Autolinear Redisplay stretch based on selection that contains the features of interest, avoiding large areas of cloud. The result should resemble that of figure 1.

Upload: others

Post on 20-Mar-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Displaying an image in polar projectionThe Bilko formula latlon_grid_map_hires2.frm is designed to apply grids at a specific interval, determined by the modulus, which corresponds

LearnEO! Bilko Tutorial T11.7 www.learn-eo.org/tutorial/

Displaying an image in polar projection This tutorial sheet assumes that you already know how to display MERIS level 1 data as colour composite images. If not, download and try T2.4 Displaying MERIS data as a colour composite; this uses the same MERIS image and explains how to create true colour composites.

Required resources • MER_FR__1PNEPA20080812_095210_~.N1 - Envisat MERIS Full Resolution Level 1 data

from the Barents Sea. • Tools for the tutorial:

o arctic_coastline_67-90n_0-60e.dat.bz2 - coastline data in USGS Mapgen format from the NOAA National Geophysical Data Centre (NGDC) Coastline Extractor.

o Formulas: latlon_grid_map_hires2.frm and rgb_coastline_grid.frm

Detailed instructions Open the MERIS image MER_FR__1PNEPA20080812_095210_~.N1 and create a colour composite. Give the image an Autolinear Redisplay stretch based on selection that contains the features of interest, avoiding large areas of cloud. The result should resemble that of figure 1.

Page 2: Displaying an image in polar projectionThe Bilko formula latlon_grid_map_hires2.frm is designed to apply grids at a specific interval, determined by the modulus, which corresponds

Figure 1. True colour composite displayed using and Autolinear Redisplay stretch based on a sub-selection defined by a square surrounding the cloud-free region of the plankton bloom.

Resampling  to  a  polar  projection    To carry out the instructions below, you need to know the approximate dimension of the image you want to resample. The quickest way to find this is to open the Resample dialog for the MERIS image. Activate the MERIS colour composite (click on it) and select Image > Resample from the menu bar. 2

When the Resample dialog (figure 2) opens, select the Window tab and make a note of the latitude and longitude dimensions. Then select the Pixel tab and make a note of the pixel width and height. Finally select the Image tab and make a note of the height and width of the image.

Figure 2. Resample dialog showing the Interpolation tab (top left) - the default setting, the Window tab (top right) which shows the longitude (x) of the left and right sides and the latitude (Y) of the top and bottom of a window that will include the full image, the Pixel tab (bottom left), which shows the approximate pixel size (width and height in degrees, minutes and seconds - note height is in the South direction) and the Image tab, which gives the approximate size of the image when resampled to a regular latitude, longitude grid using the given Window and Pixel settings. .

Question  1        What Windows and Pixel settings would you use to open a coastline map to a window size and pixel size that would suit this MERIS image? (Calculate these in decimal degrees, rounding to the Window coordinates to 2 decimal points, and the pixel size to 4 decimal points.)

Opening  a  coastline  map  for  the  image  Open arctic_coastline_67-90n_0-60e.dat. When the Extract dialog appears, select the Initialise tab. Leave the Interpolation as Based on Self, but change the Null value to 255. Click Apply (if you

Page 3: Displaying an image in polar projectionThe Bilko formula latlon_grid_map_hires2.frm is designed to apply grids at a specific interval, determined by the modulus, which corresponds

forget this step, you will lose the new Initialise settings.

Select the Window tab. Most of the MERIS image is contained in a window with the following dimensions:

• Longitude: 25.35 E to 49.08 E, • Latitude 75.11 N to 67.22 N

Set the window size accordingly, and click Apply.

The pixel size of the MERIS image can be rounded up to a width of 0.008 longitude (easier than 0.007) and down to a height of 0.002 latitude for simplicity. Change these settings and apply the new size.

If you wish, you can check that the new Image size is about the same as in the original. There will be some change because of the rounding, but if you are out by many hundred pixels, then something has cone wrong. Most likely you have forgotten to apply the new settings. If this is the case, go back and check on the Window and Pixel size to see if these are set as you intended. Correct them and make sure to click Apply.

Once you are happy with the settings, click OK. The line map will open in a regular lat/lon grid, with the spatial resolution you specified in the Extract dialog.

Creating  a  coordinate  grid  for  the  image  Based on the coastline we can now create a latitude longitude grid using a modulo function.

Modular arithmetic is a system of arithmetic for integers, where numbers 'wrap around' after they reach a certain value – called the modulus. One way to understand this is to consider the hours on a 12-hour clock face. 10 o’clock plus 3 hours is 1 o’clock (not 13 o’clock). 9 o’clock plus nine hours gives 6 o’clock. Since the time starts over at 1 after passing 12, this is similar to arithmetic modulo 12, except that normal modular arithmetic would begin at 0 and “roll over” after 11. The 24-hour clock, which goes from 00:00 to 23:59, is an approximation to modular arithmetic, using a modulus of 24.

By using the modulo function in Bilko formula documents in combination with column and row (x and y) coordinate values you can set up grids. With real images with geographic coordinates these can be set up so as to lie latitude and longitude grid lines, thus overlaying a map grid onto an image. The modulo function returns the remainder which is left after dividing by the modulus. Thus 12 modulo 10 returns 2, the remainder left after dividing 12 by the modulus (10). 9 modulo 10 = 9, 15 modulo 10 = 5, and 20 modulo 10 = 0. Thus when the modulo function returns zero you are at an exact multiple of the modulus.

The Bilko formula latlon_grid_map_hires2.frm is designed to apply grids at a specific interval, determined by the modulus, which corresponds to the latitude and longitude interval you want to use between grid lines. Open the formula and examine its content; make sure you understand what the formula does.

Set the formula Options! to provide the same output as @1. With the formula active, click Copy1 (keystroke CTRL+C), then activate the coastline map and click Paste (CTRL+V). This will create a new grid image with the same window and pixel dimensions as the original coastline map.

When the new image appears, click on some of the latitude and longitude gridlines to check that they are in the correct position. (You will need to do some rounding when you do this checking,

1 Remember applying a formula is not the same as copying text, so you should NOT shade the formula text before clicking Copy.

Page 4: Displaying an image in polar projectionThe Bilko formula latlon_grid_map_hires2.frm is designed to apply grids at a specific interval, determined by the modulus, which corresponds

because the resolution is not sufficiently precise; however, the location of a line should be less than one pixel size away from a whole degree).

Once you are happy with the grid, close the Arctic coastline map.

Resampling  the  grid  to  polar  projection  With the new grid active, select Image > Resample from the menu bare.

In the Initialise tab choose Self polar projected, and set the Null to 255. Click Apply.

In the Windows tab accept the default; click OK.

Select the Pixel tab. Polar projections resample using square pixels and the coarsest resolution (0.008 longitude). To get the pixel size you want in the latitude direction, you need to change the width to be the same as the height (see figure on the right). Do this and Apply.

Next select the Image tab to check that the image is a sensible size of similar image dimensions (height & width) to the original MERIS image. (A little smaller is fine, but you should be within the same order of magnitude. If not, check your window and pixel settings and remember to click Apply.)

Click OK to resample the grid.

The image that emerges will be a sector image with latitude lines as circles, and longitude lines radiating from a point outside the image, which represents the North Pole.

Once you are happy that the new polar grid looks right, close the original regular grid image.

Opening  the  coastline  map  based  on  the  polar  projected  grid  Open the coastline again. When the Extract dialog opens, select the Initialise tab, open the Based On dropdown menu to select the polar grid you created earlier as the Master image (see figure, left, but note that your image number may be different from that shown)2. Set the Null to 255 and click Apply.

This is all you need to do, as the master image (the polar grid) will provide all the other information necessary. Click OK to open the coastline.

2 If in doubt about what image in the list is the right one, close the connect, and save the polar grid image as 'polar_grid.dat' . When you open the Connect dialog again, it will be easy to recognise it by its name.

Page 5: Displaying an image in polar projectionThe Bilko formula latlon_grid_map_hires2.frm is designed to apply grids at a specific interval, determined by the modulus, which corresponds

Resampling  the  colour  composite  based  on  the  polar  projected  grid  You can resample the MERIS image using either the polar grid or the polar coastline as the Master image. Activate the colour composite (click on it) and open the Resample dialog (Image > Resample). Select the Interpolation tab and choose the polar projected grid from the Based on drop-down menu. Leave the Null value at 0 (black) and click Apply to enter this choice. Click OK to start resampling the image.

Once the resampling is complete, you will notice that there is quite a lot of black surrounding the image – the reason will become clear when you apply the grid and coastline. The images that make up the new composite have been numbered from red to blue, with the first image to appear as the red, the second as green and the third as blue. Make sure you know which image number represents which colour channel.

Applying  the  coastline  and  grid  Open the formula rgb_coastline_grid.frm and examine the content. This requires 4 images in a stack, which is organised as described in the constant declarations. Set the formula Options! (menu bar) as described in the formula.

Activate the polar coastline image. From the menu bar select Image > Connect, and then select the coastline and 3 resampled MERIS images from the available options. Make sure the Stack check box is checked.

Check that the images are in the correct order in the stack (the order given in the formula). If not use the keyboard number keys to move an image to the correct position in the stack3.

Activate the formula, click Copy, move to the new stack, and click Paste. If you watch the colour composite image you will see how the grid and coastline now appear on the image.

The Redisplay stretch will be reset, leaving the image rather blue. Use the box selection tool to draw a box around the bloom region, which avoids most of the cloud. (A little cloud is OK, and there is no need to worry about including a few gridlines, as they are so thin). From the Image menu open the Redisplay and apply an Autolinear stretch based on this selection. The result should look like the image shown above.

To save the gridded composite for use in reports or on-line, you need to save it as a new image with stretches applied. Use the box selection to select the region you want, and open a new file. In the New dialog, select Image, and make sure the Apply stretches to new documents box is checked.

Select Save As to save the new image with a suitable name and File type Windows. bmp.

3 Select the images that the formula lists as No. 1 in the stack, then type 1 on the keyboard. Do the same for the images that should be No. 2 (keystroke 2) and No. 3 (keystroke 3).

Page 6: Displaying an image in polar projectionThe Bilko formula latlon_grid_map_hires2.frm is designed to apply grids at a specific interval, determined by the modulus, which corresponds

Answers  1  We will want a window that contains the whole image, but to make it easier to apply grids and remember the coordinates, we round the values to the nearest decimal degrees (two decimal points should be suitable). We also calculate the pixel size in decimal degrees rounding to the nearest 3 decimals. The table below shows how the calculations have been made.

WINDOW PIXEL IMAGE Window Start (top left) Window End (bottom right) Pixel size in degrees Size in pixels Deg Min Sec Deg Deg Min Sec Deg Deg Min Sec Deg Old New Longitude 25 20 49.38 25.35 49 4 58.46 49.08 0 0 26.38 0.0073 Col 3239 3251 Latitude 75 6 36.87 75.11 67 13 15.15 67.22 0 0 7.75 0.0022 Row 3663 3586

Remember there are 60 minutes per degree and 60 seconds per minute, so to calculate the decimal degrees you need the following formula: Decimal degrees = Degrees + Minutes/60 + Seconds/3600

To make the calculations easier later on, it makes sense to round the Pixel size for longitude up to 0.008 and the Pixel size for Latitude down to 0.0002.