Skip to main content

Prerequisites

This data recipe requires the user’s computing system to have Microsoft Excel and the NASA Panoply software installed. 

Software and Platforms Tested

 Windows 11 OS        Panoply 5.3.2 and Microsoft Excel  

If you do not have Panoply installed, first download and install the software from NASA Goddard Institute for Space and Studies.  Please note that Panoply version 5.x requires an installation of Java 11.  Please review the README documentation provided with the Panoply software download files for additional instructions and guidance.

Procedure

1. Giovanni

Before accessing data at GES DISC, a user must first register with Earthdata Login, then be authorized to access data at GES DISC by following the steps outlined at this data-access link.

The first procedure uses Giovanni (https://giovanni.gsfc.nasa.gov) to get the MODIS sea surface temperature maps and corresponding NetCDF data files of the Eastern Pacific Ocean for the two specified time periods.  We will be using a monthly data product.  The data product is called Sea Surface Temperature (SST) at 11 microns (Night) (water only) (MODISA_L3m_NSST_Monthly_4km_vR2019.0). The latitude-longitude coordinates for the region used in this example are 99.9792 W (western boundary), 1.52083 S (southern boundary), 88.2708 W (eastern boundary), and 5.645831 N (northern boundary).

The Giovanni interface with these selections made, for the January-March 2014 time period, is shown below.

Image
Image Caption

Figure 1: Giovanni Selection Screen for MODIS Data

Using these selections, click the green “Plot Data” button in the lower right-hand corner of the screen to generate the first map.  You may download the map by clicking on the “Download” drop-down menu (upper right-hand corner of the generated map), which gives you the option to download the map as a GeoTIFF, KMZ, PNG, or NetCDF.  However, for this tutorial, you will need the NetCDF (.nc suffix) data file for use in Panoply software.  Click on the "Downloads" selection in the panel to the left of the map, then click on the "NetCDF" file link to download the .nc file. See the first two images below showing the results screen for the first map plot, and the Downloads page.

Image
Image Caption

Figure 2: Example Time-Averaged Sea Surface Temperature MODIS Plot

Image
Image Caption

Figure 3: Download menu for the selected variable

Next, open the  Options dropdown, then click the Options map window in the upper right-hand corner of the plot. Select "View All Palettes", then select the "Blue-Yellow-Red (Div), 11" radio button, and finally click "Add Palette".  Next, adjust the min-max values to be a low of 20 (degrees Celsius) and a high of 35 (degrees Celsius), then click on Re-Plot to apply all these changes and observe the map.  You can download the map image as stated above if desired.

Next, select the "Back to Data Selection" button in the lower right-hand corner of the plot screen, change the date range to 2015, and select the green "Plot Data" button again.  Download the second NetCDF file for 2015. Finally, re-apply the above map plot settings used for the 2014 map to compare the 2014 data to the 2015 data, and download the map image if desired.  The next two images represent the SST maps for January-March 2014 (top) and January-March 2015 (bottom).

Image
Image Caption

Figure 4: January-March 2014 Time Averaged MODIS SST Plot

Image
Image Caption

Figure 5: January-March 2015 Time Averaged MODIS SST Plot

2. Panoply

First, you will need to have Panoply installed. It can be obtained from the Panoply Web site.

Start Panoply.  The first window is very simple; it requests a file to open. Navigate to the directory with the NetCDF files, and open the file with the 2014 data.

When the file is open, five rows of data will be shown, along with the metadata header (the contents of which are shown in the window at right).

Now click “File”, and then “Open”, to open the second file with the 2015 data.  The same set of rows for this file will then be displayed in the Panoply window.  When both files are opened, the Panoply window will look like this:

Image
Image Caption

Figure 6: Panoply File Selection Window

For the 2014 data, click on the “Sea Surface Temperature at 11 microns (Night) (water only)” row, which will highlight it (as shown above).  The “Create Plot” icon at top left should become brighter, indicating it is active.  Click the icon, and a window will open with plot options.  Select the default option to create a "Georeferenced Longitude-Latitude color contour plot”, and click “Create”.  The plot will appear in a new window.  To zoom in to the proper map scale, click on “Plot” above the map, and click “Zoom Plot In” seven times. 

Then navigate to "Window" and click "Plot Controls" at the top of the map which opens a smaller, separate "Plot Controls" window containing several tabs for your map plot settings.  Navigate to the "Map Projection" tab in the Plot Controls window, and center the plot on -90.0⁰ E and 2.0⁰ N, which centers the data in the window.  Your map should now look like this:

Image
Image Caption

Figure 7: MODIS SST Example Plot

Note that this is a different color palette than used in Giovanni.  Panoply has an extensive variety of color palettes, which will be important for the difference map.

Now return to the main Panoply window (without closing the open map plot window), and click once on the 2015 “Sea Surface Temperature at 11 microns (Night) (water only)” row from the second dataset that was imported.  This time, select the "Combine Plot" icon, and you’ll get a small window asking “In which existing plot should I combine the variable?”.  From here, click “Combine” with the default selection.  The plot will change color to be all blue (this is normal).  This creates the difference map.

In the Plot Controls window "Arrays" tab, notice that the "Plot" setting indicates “Array 1 – Array 2” (you will change this later).  Next, navigate to the “Scale” tab in the Plot Controls window, and click the “Fit to Data” button.  This will plot the actual data range of the difference map with the current palette.  Your map should now look like this for Array 1 - Array 2:

Image
Image Caption

Figure 8: MODIS SST Plot with Adjusted Scale

Now go back to the “Arrays” tab in the Plot Controls window, and switch the difference option field to “Array 2 – Array 1”.  Again, select the "Fit to Data" button from the Plot Controls window "Scale" tab.  Now the map should look like this:

Image
Image Caption

Figure 9: MODIS SST Array 2 - Array 1 Difference Map

This is a good difference map, but it is not plotted with an ideal palette to show differences.  One of the best palettes for this purpose is a red-white-blue palette, with white in the middle, which would indicate no difference.  Navigate to the “Scale” tab in the Plot Controls window, and change the color palette to “GMT_polar.cpt” from the dropdown (they are listed in alphabetical order). Your map should now look similar to the below:

Image
Image Caption

Figure 10: MODIS SST Difference Map with Updated Color Scale

One thing to notice, though, is that the palette isn’t “balanced”; the minimum value is about -2.3, while the maximum value is about +1.6.  To make a “balanced” map, change the scale range, with the minimum set to -1.9, and the maximum set to +1.9.  Your map should now look similar to the below:

Image
Image Caption

Figure 11: MODIS SST Difference Map with Adjusted Scale

3. Excel

Before you open Excel, there is one procedure to perform first. Go back to the Panoply window, select the SST data row, and right-click it. Select “Export CSV”. You may rename the file (it’s a good idea to have the dates in the filename to make it easier to track what you are doing). Do this for both SST data rows, for January-March 2014 and January-March 2015. Then, for either year, export both the lat data as CSV and the lon data as CSV, the same way as for the SST data.

In the directory you stored the CSV data in, the files should appear as Excel files (with Excel installed on your system). There should be four files; SST for January-March 2014 and for January-March 2015, a lat data file, and a lon data file.

If you click on the icon that looks like this (below), the file should automatically open in Excel. Rename the files. In this case, we renamed them “2014_SST” and “2015_SST”. After renaming, open the data file with the data from January-March 2015. Save this file as an Excel workbook (.xlsx or .xlsm extension, but this workbook does not need to have macros enabled).

Now open the file with the January-March 2014 data. The single sheet with the data should have the same name as the data file. Right-click on this, and then click on “Move or Copy…”. At the top, you should be able to find the Excel workbook you just created with the 2015 data. Select this file and then click “OK”. The data will be copied to the new workbook. Save the workbook.

The next step is to calculate the differences, which is a simple procedure. In the workbook, create a new sheet and name it “Difference”. In the first cell of that sheet (A1), type the formula below. The sheet names will be whatever you named the two sheets with the SST data.

    ='2015_SST'!A1-'2014_SST'!A1

Once you have typed this formula into the cell, copy it. Make sure you copy the formula, not the numerical value in the A1 cell. Click in another cell, and a numerical value should appear in cell A1.

Now go to one of the two data arrays, and determine the size of the array. To do this, slide the vertical slider to the bottom, and the horizontal slider all the way to the right. Note the final column header (a letter or set of two or three letters) and the final row number. In this example, the final column header is JV, and the final row number is 173.

Go back to the Difference sheet. Select the same array size as the SST data sheets. (With the cursor in the A1 cell – you should see a “fat” white cross -- left-click and slide to the right until you reach the final column header, then slide down to the final row number. If you have a very large array, this will take a short time to do.) Copy the formula from the Menu bar.

With the entire array selected, click Ctrl-Enter. This will put the formula into all the cells, and the difference values will be calculated.

The final procedure is to construct a macro-enabled worksheet that will allow the conversion of the difference values data array into a list of lat-lon-difference value triads.

The next step is to calculate the differences, which is a simple procedure. In the workbook, create a new sheet and name it “Difference”. In the first cell of that sheet (A1), type this formula. The sheet names (shown in bold type below) will be whatever you named the two sheets with the SST data.

='2015_SST'!A1-'2014_SST'!A1

Once you have typed this formula into the cell, copy it. Make sure you copy the formula, not the numerical value in the A1 cell. Click in another cell, and a numerical value should appear in cell A1.

Now go to one of the two data arrays, and determine the size of the array. To do this, slide the vertical slider to the bottom, and the horizontal slider all the way to the right. Note the final column header (a letter or set of two or three letters) and the final row number. In this example, the final column header is JV, and the final row number is 173.

Go back to the Difference sheet. Select the same array size as the SST data sheets. (With the cursor in the A1 cell – you should see a “fat” white cross – left-click and slide to the right until you reach the final column header, then slide down to the final row number. If you have a very large array, this will take a short time to do.) Copy the formula from the Menu bar.

With the entire array selected, click Ctrl-Enter. This will put the formula into all the cells, and the difference values will be calculated.

The final procedure is to construct a macro-enabled worksheet that will allow the conversion of the difference values data array into a list of lat-lon-difference value triads.

4. Excel Macro

Open a blank Excel workbook. Copy the Difference values array into the new workbook. Save the workbook as a Macro-enabled Excel workbook.

The first thing to do with the new array is to convert the undefined values to a letter sequence. In the original SST data arrays, if a pixel had no data, the cell would have NaN in it. When the difference calculation is made, any cells with NaN will have an undefined result, which in the Difference array will appear as “#VALUE!”, indicating the failure of the formula. To fix this, under the Home tab, go to “Find and Select”, click “Go to Special”, and then click Formulas. Under Formulas, uncheck all the boxes except Errors. Then click “OK”. All of the undefined cells will be found. The formula for the first cell with the error will appear at the top. Delete the formula, type “NaN”, then click Ctrl-Enter. All of the cells with undefined values should now have NaN instead. Name the array (“SSTDiff” was chosen here), and save the workbook.

Now add two rows at top and one column at left to this array. In the A1 cell, type a name for the array (“SSTDiff” was used again). In the A2 cell, type “lat”. In the B1 cell, type “lon”. It is necessary to count the number of columns (lon data) now. In the B2 cell, type “1”. In the C2 cell, type “2”. Then select both cells, click and hold on the “Fill Handle” (the little green box at the bottom right of the two cells), and drag the fill handle to the last column of values. When you release it, the cells will be filled with consecutive values. Note the number in the last column. In this case, it’s under JW, because a column was added, and the number is 282.

Now add three more spreadsheets to the workbook. Name them lat, lon, and Results. You must have spreadsheets named lat, lon, and Results!

Open the latitude values CSV file, and copy the values. Go to the lat spreadsheet, click in the A1 cell, click the Paste icon, and select the Transpose option (at right in the second row). This will convert the data from a row to a column. Add a row, and type “lat” in the A1 cell. Follow the same procedure for the longitude data, except type “lon” in the A1 cell for that spreadsheet.

The next step is to install the macro.

The text of the macro “ReOrganizeSub” is given below. The important text (that will need to be edited) is in bold font. The instructions for installation follow. (You may wish to copy this into a text file before copying it into the Excel workbook.)

Note 1: The worksheets that contain the data must match the names of the worksheets in the code below, otherwise the code cannot find the data! That’s why the spreadsheets must be named lat, lon, and Results.

Note 2: The size of the MatrixAry array in the code must, at a minimum, be the size of the input lists and that of the For/Next loop.

Sub ReorganizeSub()

 

    Dim MatrixAry(1 To 200, 1 To 300, 1 To 3) As String

 

    Dim i As Integer

    Dim j As Integer

    Dim RowIvb As Long

    Const LatNdx As Integer = 1

    Const LongNdx As Integer = 2

    Const ValueNdx As Integer = 3

   

    For j = 1 To 282

   

        For i = 1 To 173

       

            MatrixAry(i, j, LatNdx) = Worksheets("lat").Range("A" & i + 1).Value

            MatrixAry(i, j, LongNdx) = Worksheets("lon").Range("A" & j + 1).Value

            MatrixAry(i, j, ValueNdx) = Worksheets("SSTDiff").Range(NumToLtr(j + 1) & i + 2).Value

       

        Next i

   

    Next j

   

 

    For j = 1 To 282

   

        For i = 1 To 173

       

            RowIvb = RowIvb + 1

           Worksheets("Results").Range("A" & RowIvb).Value = MatrixAry(i, j, LatNdx)

            Worksheets("Results").Range("B" & RowIvb).Value = MatrixAry(i, j, LongNdx)

            Worksheets("Results").Range("C" & RowIvb).Value = MatrixAry(i, j, ValueNdx)

       

        Next i

   

    Next j

 

End Sub

 

Function NumToLtr(ColNumIvb) As String

 

    If ColNumIvb <= 26 Then 'if a single letter

        NumToLtr = Chr(ColNumIvb + 64)

    ElseIf ColNumIvb <= 702 Then 'if a two letters

        NumToLtr = Chr(Int((ColNumIvb - 1) / 26) + 64) & Chr(((ColNumIvb - 1) Mod 26) + 65)

    ElseIf ColNumIvb <= 18278 Then 'if a three letters

        NumToLtr = Chr((Int((ColNumIvb - 703) / 676) Mod 26) + 65) & Chr((Int((ColNumIvb - 27) / 26) Mod 26) + 65) & Chr(Int((ColNumIvb - 1) Mod 26) + 65)

    End If

 

End Function

Macro Installation Instructions

Go to File Options

Activate the Developer tab under “Customize Ribbon” and close Options

Go to Developer tab

Go to the Visual Basic icon (at left)

Go to Insert, drop down to Module, click on Module.

At this point, there will be an empty space. Copy the text of ReorganizeSub into this space.

The macro will retain the name ReorganizeSub, but once it has been imported, the module can be named to save the workbook for future use with the module installed.

  1. To adapt the macro to the data array, the final values will be entered for the array size, and the data set name will be entered from the data value sheet. In this case, the number of latitude values, i, is 173 (two less than the total number of rows in the SSTDiff array), so in both occurrences of “For i = 1 To final”, change final to 173. The number of longitude values is 282, so in both occurrences of “For j = 1 to final”, change final to 282. (These values are for the example; for other array sizes, they will be changed as appropriate for the number of lat and lon values in the array).

Then change data set name to “SSTDiff”.

Now the macro is ready. There are two different ways to run the macro. (1) In the Developer pane, click on Run, then click Run Sub/User Form. (2) If the spreadsheet has been saved with the macro, then under the Developer tab, click Macros (at left), which will open the macro (and the name
ReOrganizeSub will be highlighted), then click "Run Macro". The lat-lon-difference value triads should be written to the Results spreadsheet. Below is what they look like. “NaN” was a pixel with no data.

Additional Info

There are a lot of steps in these procedures, but note that making the difference maps with Panoply is quite fast. The difference mapping can be done until the best results are obtained, and then the quantification with Excel can be performed. Quantifying with Excel is only necessary if the actual values are needed.

There is a limit of how many rows can be written in an Excel file. The maximum number is 1,048,576 rows. That may seem like a lot, but with higher-resolution data (like 4 km ocean color data), it can easily be exceeded. If attempting to get values for a very large area, the region may have to be subset and these subsets analyzed with separate spreadsheets.

Make sure there are no blank cells in the Results array. If there are, either the lat value or lon value for the number of values is incorrect.

Details

Last Updated

Dec. 2, 2026

Published

Dec. 1, 2020

Data Archive

Goddard Earth Sciences Data and Information Services Center (GES DISC)