<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Thombson Chungkham on Medium]]></title>
        <description><![CDATA[Stories by Thombson Chungkham on Medium]]></description>
        <link>https://medium.com/@ch.thombson18?source=rss-769a0b7a5d73------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Ce8zC_S3fLoqorejLfMlOg.png</url>
            <title>Stories by Thombson Chungkham on Medium</title>
            <link>https://medium.com/@ch.thombson18?source=rss-769a0b7a5d73------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 21:51:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ch.thombson18/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Converting Swath to Grid data using Python]]></title>
            <link>https://medium.com/@ch.thombson18/converting-swath-to-grid-data-using-python-fe1cbbcad1e8?source=rss-769a0b7a5d73------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe1cbbcad1e8</guid>
            <category><![CDATA[projection-mapping]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[cryosphere]]></category>
            <category><![CDATA[netcdf]]></category>
            <category><![CDATA[remote-sensing]]></category>
            <dc:creator><![CDATA[Thombson Chungkham]]></dc:creator>
            <pubDate>Wed, 30 Aug 2023 19:13:15 GMT</pubDate>
            <atom:updated>2023-08-30T19:13:15.597Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BdQQYZvCefZgqHR4SkXsng.png" /></figure><h3>Introduction</h3><p>We are going to convert the swath data to grid data of Brightness Temperature (Tb) of Special Sensor Microwave Imager/Sounder (SSMIS) which is a satellite passive microwave radiometer aboard Defense Meteorological Satellite Program (DMSP) (F15, F16, F17 and F18) since 1987. These are near-polar orbiting satellites. SSMIS channels used to calculate brightness temperatures include 19.3 GHz vertical and horizontal, 22.2 GHz vertical, 37.0 GHz vertical and horizontal, and 91.7 GHz vertical and horizontal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*cKRfIBdXhqtFwj3X9IplBw.png" /></figure><p>Details are available <a href="https://www.remss.com/missions/ssmi/">here</a>. We are going to project the final gridded data to Polar Stereographic South.</p><h3>Pre-requisite knowledge</h3><p>Knowledge of numpy, matplotliband map projection in general are needed. And That’s it!!!</p><h3>Data</h3><p>The NetCDF file used in this excercise can be found <a href="https://github.com/Thombson747/thombson747.github.io/blob/main/RSS_SSMIS_FCDR_V07R00_F17_D20200101_S0120_E0312_R67894.nc">here</a> as “RSS_SSMIS_FCDR_V07R00_F17_D20200101_S0120_E0312_R67894.nc” file. Please refer to this <a href="https://medium.com/@ch.thombson18/reading-and-displaying-saral-altika-brightness-temperature-data-using-python-c2fc52eb1eb1">article</a> for more information about reading NetCDF file.</p><h3>Necessary Libraries</h3><p>NetCDF files can be read with a few different Python modules. We will use netCDF4. We will also usepyresample library. Pyresample is a python package for resampling geospatial image data. You can use pyresample to transform data in one coordinate system to another coordinate system (ex. mercator projection) using one of the available resampling algorithms. In this exercise, pyresample is used to convert swath data to grid data using resampling method. Details about this library and how to install it can be found <a href="https://pyresample.readthedocs.io/en/latest/index.html">here</a>.</p><h3>Reading netCDF file</h3><p>We will use the netCDF.Dataset() attribute for reading the netCDF file. Let’s read the netCDF file and explore the variables:</p><pre>#Importing the necessary libraries<br>from netCDF4 import Dataset<br>from pyresample import kd_tree, geometry, save_quicklook, SwathDefinition<br><br>#Reading the netCDF file<br>data = Dataset(r&#39;\path\to\file.nc&#39;)<br>print (data)</pre><p>The output:</p><pre>&lt;class &#39;netCDF4._netCDF4.Dataset&#39;&gt;<br>root group (NETCDF4 data model, file format HDF5):<br>    Conventions: CF-1.6<br>    Metadata_Conventions: CF-1.6, Unidata Dataset Discovery v1.0, NOAA CDR v1.0, GDS v2.0<br>    standard_name_vocabulary: CF Standard Name Table (v16, 11 October 2010)<br>    id: RSS_SSMIS_FCDR_V07R00_F17_D20200101_S0120_E0312_R67894.nc<br>    naming_authority: gov.noaa.ncdc<br>    metadata_link: gov.noaa.ncdc:C00810<br>    title: RSS Version-7 SSMIS FCDR<br>    product_version: v07r00<br>    date_issued: 2012-12-31<br>    summary: Remote Sensing Systems (RSS) Version-7 Special Sensor Microwave Imager Sounder (SSMIS) Fundamental Climate Data Record (FCDR); intercalibrated and homogenized brightness temperature polar-orbiting product with quality flags<br>    keywords: EARTH SCIENCE &gt; SPECTRAL/ENGINEERING &gt; MICROWAVE &gt; BRIGHTNESS TEMPERATURE<br>    keywords_vocabulary: NASA Global Change Master Directory (GCMD) Earth Science Keywords, Version 6.0<br>    platform: DMSP 5D-2/F17 &gt; Defense Meteorological Satellite Program-F17<br>    sensor: SSMIS &gt; Special Sensor Microwave Imager Sounder<br>    cdm_data_type: Swath<br>    cdr_program: Climate Data Record Program for satellites, FY 2011<br>    cdr_variable: fcdr_brightness_temperature_19V, fcdr_brightness_temperature_19H, fcdr_brightness_temperature_22V, fcdr_brightness_temperature_37V, fcdr_brightness_temperature_37H, fcdr_brightness_temperature_92V, fcdr_brightness_temperature_92H<br>    source: F17_r67894.dat<br>    date_created: 20200106T210942Z<br>    creator_name: Carl Mears<br>    creator_url: http://www.remss.com/<br>    creator_email: mears@remss.com<br>    institution: Remote Sensing Systems<br>    processing_level: NOAA Level 2<br>    references: doi:10.1175/2007JAMC1635.1, doi:10.1126/science.1140746, SSM/I Users Interpretation Guide UG32268-900 Rev C 29 Nov 2000<br>    history: 1) 2011-09-30, Carl Mears, Remote Sensing Systems, created initial netCDF file converted from the original RSS data format<br>    geospatial_lat_min: -89.159996<br>    geospatial_lat_max: 89.2<br>    geospatial_lon_min: -180.0<br>    geospatial_lon_max: 179.98999<br>    geospatial_lat_units: degrees_north<br>    geospatial_lon_units: degrees_east<br>    spatial_resolution: 19 V/H GHz: 46.5km X 73.6km, 22 V GHz: 46.5km X 73.6km, 37 V/H GHz: 31.2km X 45.0km, 92 V/H GHz: 13.2km X 15.5km<br>    time_coverage_start: 2020-01-01 01:20:02Z<br>    time_coverage_end: 2020-01-01 03:12:05Z<br>    time_coverage_duration: PT6723S<br>    license: No restrictions on access or use<br>    contributor_name: Frank Wentz, Carl Mears<br>    contributor_role: Principal investigator and originator of input/source or antenna temperature data, Processor and author of entire driver routine (write_ssmi_tbs_netcdf.pro) which converts RSS native brightness temperature format to netCDF-4.<br>    dimensions(sizes): scan_number(3542), footprint_number_hires(180), footprint_number_lores(90), eleven_flags(11), four_flags(4), numchar(20)<br>    variables(dimensions): int32 iorbit(), float64 scan_time_hires(scan_number), float64 orbit_position(scan_number), float32 sc_lat(scan_number), float32 sc_lon(scan_number), float32 sc_alt(scan_number), int8 iscn_flag(eleven_flags, scan_number), int8 ical_flag_lores(four_flags, scan_number), int8 ical_flag_hires(four_flags, scan_number), int16 latitude_hires(scan_number, footprint_number_hires), int16 longitude_hires(scan_number, footprint_number_hires), int16 earth_incidence_angle_hires(scan_number, footprint_number_hires), int16 earth_azimuth_angle_hires(scan_number, footprint_number_hires), int16 sun_glitter_angle_hires(scan_number, footprint_number_hires), int8 land_flag_hires(scan_number, footprint_number_hires), int8 ice_flag_hires(scan_number, footprint_number_hires), float32 fcdr_brightness_temperature_92V(scan_number, footprint_number_hires), float32 fcdr_brightness_temperature_92H(scan_number, footprint_number_hires), int16 latitude_lores(scan_number, footprint_number_lores), int16 longitude_lores(scan_number, footprint_number_lores), int16 earth_incidence_angle_lores(scan_number, footprint_number_lores), int16 earth_azimuth_angle_lores(scan_number, footprint_number_lores), int16 sun_glitter_angle_lores(scan_number, footprint_number_lores), int8 land_flag_lores(scan_number, footprint_number_lores), int16 ice_flag_lores(scan_number, footprint_number_lores), float32 fcdr_brightness_temperature_19V(scan_number, footprint_number_lores), float32 fcdr_brightness_temperature_19H(scan_number, footprint_number_lores), float32 fcdr_brightness_temperature_22V(scan_number, footprint_number_lores), float32 fcdr_brightness_temperature_37V(scan_number, footprint_number_lores), float32 fcdr_brightness_temperature_37H(scan_number, footprint_number_lores)<br>    groups: </pre><p>I know it is a lot of metadata. If you are new to netCDF file then I recommend you go through this <a href="https://medium.com/@ch.thombson18/reading-and-displaying-saral-altika-brightness-temperature-data-using-python-c2fc52eb1eb1">article</a> first.</p><p>Let’s read the variables:</p><pre>#Reading the variables<br>longitudes = data [&#39;longitude_lores&#39;][:] <br>latitudes = data [&#39;latitude_lores&#39;][:] <br><br>tb = data[&#39;fcdr_brightness_temperature_19H&#39;][:]</pre><p>The variables have the following shape:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*ecTRneXnhi9_rjXb-dKeRw.png" /></figure><p>Pyresample can be used to resample a swath dataset to a grid, a grid to a swath or a swath to another swath. Resampling can be done using nearest neighbour method, Guassian weighting, weighting with an arbitrary radial function.</p><h3>Swath Definition</h3><p>A swath is defined by the longitude and latitude values of the data points. We will use the SwathDefinition attribute.</p><pre>#Swath Definition<br>swath_def = geometry.SwathDefinition(lons=longitudes, lats=latitudes)</pre><h3><strong>Area Definition</strong></h3><p>The cartographic definition of grid areas used by Pyresample is contained in an object of type AreaDefintion. The following arguments are needed to initialize an area:</p><ul><li><strong>area_id </strong>ID of area</li><li><strong>name</strong>: Description</li><li><strong>proj_id</strong>: ID of projection</li><li><strong>proj_dict</strong>: Proj4 parameters as dict</li><li><strong>x_size</strong>: Number of grid columns</li><li><strong>y_size</strong>: Number of grid rows</li><li><strong>area_extent</strong>: (x_ll, y_ll, x_ur, y_ur)</li></ul><p>where</p><ul><li><strong>x_ll</strong>: projection x coordinate of lower left corner of lower left pixel</li><li><strong>y_ll</strong>: projection y coordinate of lower left corner of lower left pixel</li><li><strong>x_ur</strong>: projection x coordinate of upper right corner of upper right pixel</li><li><strong>y_ur</strong>: projection y coordinate of upper right corner of upper right pixel</li></ul><p>Let’s implement this:</p><pre>area_def = geometry.AreaDefinition(&#39;EPSG:3976 - WGS 84&#39;, <br>                                  &#39;NSIDC Sea Ice Polar Stereographic South&#39;, <br>                                   &#39;Stereographic&#39;,<br><br>                               &#39;+proj=stere +lat_0=-90 +lat_ts=-70 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +type=crs&#39;,<br><br>                               316, 332,<br><br>                               [-3950000, -3950000,<br><br>                                3950000, 4350000])</pre><p>We have <strong>area_def</strong> : ‘EPSG:3976 — WGS 84’,</p><p><strong>name</strong>: ‘NSIDC Sea Ice Polar Stereographic South’, <br><strong>proj_id:</strong> ‘Stereographic’,</p><p><strong>proj_dict: </strong>‘+proj=stere +lat_0=-90 +lat_ts=-70 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +type=crs’,</p><p><strong>x_size:</strong>316, <strong>y_size</strong>: 332,</p><p><strong>area_extent</strong>: [-3950000, -3950000, 3950000, 4350000])</p><p>The above information can be found in <a href="https://nsidc.org/data/user-resources/help-center/guide-nsidcs-polar-stereographic-projection">NSIDC’s</a> guide to Polar Stereographic Projection. The EPSG Code is <a href="https://epsg.io/3976">3976</a>. The <strong>proj_dict</strong> is the <strong>PROJ.4</strong> string of this particular EPSG. The gridded swath data will be 25 km resolution.</p><h3><strong>pyresample.kd_tree</strong></h3><p>This module contains several functions for resampling swath data. Let’s use resample_nearest attribute for resampling nearest neighbour method.</p><pre>#Resampling using Nearest Neighbour Method<br>result = kd_tree.resample_nearest(swath_def, tb,area_def, <br>                                  radius_of_influence=50000,<br>                                   epsilon = 0.5)</pre><p>The keyword arguments:</p><ul><li><strong>radius_of_influence</strong>: The radius around each grid pixel in meters to search for neighbours in the swath.</li><li><strong>epsilon</strong>: The distance to a found value is guaranteed to be no further than (1 + eps) times the distance to the correct neighbour. Allowing for uncertanty decreases execution time.</li></ul><h3><strong>Displaying data quickly</strong></h3><p>Pyresample has some convenience functions for displaying data from a single channel. The function plot.save_quicklook saves the Cartopy image directly to file.</p><pre>#Saving as a png file<br>save_quicklook(&#39;tb19h_quick_110m.png&#39;, area_def, result, label=&#39;19H Brightness Temperature (K)&#39;,<br>               num_meridians=45,<br>               num_parallels=10,<br>               cmap=&#39;turbo&#39;, coast_res=&#39;10m&#39;)</pre><p>The keyword arguments:</p><ul><li><strong>filename: </strong>path to output file. Here. “tb19h_quick_110m.png”.</li><li><strong>area_def: </strong>geometry.AreaDefinition object. Here, “area_def”.</li><li><strong>data: </strong>2D array matching area_def. Use masked array for transparent values. Here, “result”.</li><li><strong>num_meridians: </strong>Number of meridians to plot on the globe.</li><li><strong>num_parallels: </strong>Number of parallels to plot on the globe.</li><li><strong>coast_res: </strong>Resolution of coastlines. “110m” or “50m” or “10m”.</li></ul><p>The output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*whecjVHxuZZu7RmScnVpUg.png" /><figcaption>19H Brightness Temperature projected in Polar Stereographic South</figcaption></figure><h3><strong>Exporting to GeoTiff file</strong></h3><p>For those who wants to export as GeoTiff file, we need gdal library. For exporting files using gdal, please refer this <a href="https://medium.com/@ch.thombson18/converting-netcdf-to-geotiff-file-using-python-15ef6e2eaf19">article </a>for more in depth information.</p><pre>from osgeo import gdal, osr<br><br>#GeoReferencing information<br>gt = [-3950000.0, 25000.0, 0.0, 4350000.0, -0.0, -25000.0]<br>#Projection information<br>epsg = 3976<br>srs = osr.SpatialReference()<br>srs.ImportFromEPSG(epsg)<br>dest_wkt = srs.ExportToWkt()<br><br>#Creating output file<br>driver = gdal.GetDriverByName(&quot;GTiff&quot;)#Getting GeoTIFF driver<br>driver.Register()<br><br>outds = driver.Create (&quot;SSMIS_Tb_19H.tif&quot;, #Name of the putput file<br>                           xsize = result.shape[1], #Setting the number of columns<br>                           ysize = result.shape[0], #Setting the number of rows<br>                           bands = 1, #Setting the number of bands<br>                           eType = gdal.GDT_Float32) #Setting the data type i.e., float 32<br><br>outds.SetGeoTransform(gt) #Setting the geoinformation<br>outds.SetProjection(dest_wkt) #Setting the projection information<br>outband = outds.GetRasterBand(1) #Setting the number of bands<br>outband.WriteArray(result) #Writing the 2-D array on the file<br>outband = None #Closing the file<br>outds = None #Closing the file</pre><p>The gt variable conatins georeferencing information in the form of the six rows.</p><p><em>The second row is the X-direction pixel size (here in meters). Third and fifth rows are the rotational components which in this case are set to zero as the image is not rotated. The sixth row is the Y-direction pixel resolution (which is almost always negative). The first and fourth rows are the coordinates (here in meters) of the upper left corner pixel for the image.</em></p><p>The dest_wkt variable contains the projection information which in our case is <em>NSIDC Sea Ice Polar Stereographic </em>South and the<em> EPSG code is “3976”.</em></p><p>Let’s check if the output GeoTIFF file is properly created or not by opening the file using QGIS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BLNF-enLC4Nwlf1ABlUZjA.png" /><figcaption>Opening the GeoTiff file in QGIS.</figcaption></figure><p>As we can see, the GeoTiff file is created. We add the OpenStreetMap and see that the output GeoTiff file is correctly georeferenced.</p><h3>Conclusion</h3><p>We have just learnt how to convert swath data to grid data using python. Also, we exported the gridded data as GeoTIFF file as it is much easier to deal with as it contains spatial referencing information in the form of georeferenced raster imagery.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe1cbbcad1e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Monte Carlo approach to calculating uncertainty using Python]]></title>
            <link>https://medium.com/@ch.thombson18/monte-carlo-approach-to-calculating-uncertainty-using-python-7d4298a307a8?source=rss-769a0b7a5d73------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d4298a307a8</guid>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Thombson Chungkham]]></dc:creator>
            <pubDate>Mon, 12 Jun 2023 06:09:14 GMT</pubDate>
            <atom:updated>2023-06-12T06:09:14.763Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*dXg73dnhnNVQ7zuzL2gnlA.png" /></figure><h3><strong>Intro</strong></h3><p>There are cases where you cannot express an explicit functional relation between a result and the factors that contribute to the result. For example, given a large number of observations of temperature, pressure, composition, etc., you predict tomorrow’s weather using a forecasting model. Knowing the uncertainties of the input data, how uncertain will be the prediction? In a deterministic model (as opposed to a stochastic model) there is a functional relationship between input data and result, but it is complicated and implicit, with lots of correlations and interdependencies. The propagation of uncertainties is related to the <em>sensitivity </em>of the result for variations in each of the input data.</p><p>When the number of input parameters is relatively small, numerical values for the derivatives can be obtained by making a small step (preferably in both directions) for each input parameter. For a large number of input data this may not work. You may then find the uncertainty in the result by choosing many input combinations, randomly chosen from the (known) uncertainty distributions of the inputs. The computed output values will be samples of the uncertainty distribution you are looking for. Methods that use random numbers to generate results are in general called <em>Monte Carlo methods.</em></p><h3><strong>Monte Carlo approach</strong></h3><p>It is a probabilistic method based on repeated calculations of the results, using input parameters changed by a random selection from their probability distributions. Parameters and their uncertainties are therefore not simply treated as a mean value and its standard deviation, but for each input parameter real data, algorithms and distributions are used.</p><p><strong>Example</strong></p><p>A simple example will make this clear. In the measurement of the dimensions of the sides of a table, the length is found to be 120 ± 0.5 and breadth as 90 ± 0.8, both in centimeters (cm). The uncertainties are given as ±0.5 cm and ±0.8 cm for length and breadth, respectively. Let us find the uncertainty in the measurement of area of the table, A i.e., the product of length and breadth.</p><p>Let’s use Monte Carlo approach to calculate the uncertainty in the measurement of area of the table. This is done by generating a large number <em>n</em> (e.g., <em>n</em> = 1000) of normally distributed values of the input variables: length and breadth using the given values for mean and standard deviation (each input variable is now an array of length <em>n</em>) and applying the formula for area to the arrays. The output area, A is an array of samples representing the probability distribution of A. Doing this, we find A = (10794.5 ± 105.4) cm². Let us implement this in python code.</p><p><strong>Prerequisite knowledge</strong></p><p>Knowledge of numpy and matplotlib libraries is needed. That’s it‼!</p><p><strong>Python implementation</strong></p><pre>#Importing necessary libraries<br>import pandas as pd<br>import numpy as np<br>import matplotlib.pyplot as plt<br><br>def area (length,breadth): #define area of the table<br>    A = length*breadth<br>    return A<br><br>n = 1000 #Number of random samples<br>l0 = 120; l = np.random.normal (l0, 0.5, n) #Here, in np.random.normal (mean, standard_deviation, number of samples)<br>b0 = 90; b = np.random.normal (b0, 0.8, n)<br><br>A = area (l,b) #array of area values<br><br>print (&quot;Value of area without noise:&quot;, area (l0,b0))<br>print (&quot;Average value of area:&quot;, A.mean())<br>print (&quot;Systematic error due to nonlinearity:&quot;, A.mean()-area(l0,b0)) #Systematic error=mean-value without noise.<br>print (&quot;Standard deviation:&quot;, A.std()) #Uncertainty in the measurement of area.<br><br>#Plotting Cumulative Probability Distribution <br>fig, ax= plt.subplots(figsize=(10, 8))<br>plt.hist (A, cumulative=True, bins = 1000, density=True) #Density parameter is set to True to normalised the y-axis scale<br>plt.axvline(x=A.mean(), color = &#39;k&#39;, linestyle=&#39;solid&#39;, linewidth = 2)<br>ax.set_title(&quot;Monte Carlo Simulation of Area Uncertainty&quot;)<br>plt.xlabel (&#39;Area [$cm^2$]&#39;)<br>plt.ylabel (&#39;Cumulative probability distribution&#39;)<br>fig.set_dpi(300.0)<br>plt.show()</pre><p>The cumulative distribution of A is given on a probability scale in Fig. 1 (on a probability scale a normal distribution shows as a straight line; see Fig. 2)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bJL--859H9cXX-_NrVfDxA.png" /><figcaption>Fig. 1 The cumulative probability distribution function of the Monte Carlo generated result of area, using 1000 samples.</figcaption></figure><p>We see that in Fig.1, a vertical line (black line) drawn at the mean of Area corresponds to 0.5 on the y-axis which is the median and conversely, if we draw a horizontal line from 0.5 till it meets the distribution, then the corresponding value on the x-axis gives the mean of the value which is 10794.5 cm². The distribution is fairly normal between 0.21 (one standard deviation below mean) and 0.78 (one standard deviation above mean) on the y-axis, but deviates from normal beyond this range. This is due to the nonlinear relation between area and input variables. Thus, the Monte Carlo method has advantages: distortions of the resulting distribution due to nonlinearity are immediately apparent and so are systematic errors dur to nonlinearity. The latter are visible as a difference between the mean of the distribution and the value computed directly from the input values without added noise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*9BwfNep9NR7m2bPRSyU6zQ.png" /><figcaption>Fig. 2 The standardized normal cumulative probability distribution function (pdf) <em>F(z); z = (x — µ)/σ</em>, with <em>µ</em> being the mean and <em>σ</em> the standard deviation if the random variable <em>x</em>. The dashed curve is the survival function (sf), 1 — <em>F(z)</em>.</figcaption></figure><p>We also calculated the systematic error which is the mean of the distribution minus the actual value without the noise. Systematic errors have a non-random character and distort the result of a measurement. They result from erroneous calibration or just from a lack of proper calibration of a measuring instrument, from careless measurements (uncorrected parallax, uncorrected zero-point deviations, time measurements uncorrected for reaction time, etc.), from impurities in materials, or from causes the experimenter is not aware of. The latter are certainly the most dangerous type of error; such errors are likely to show up when results are compared to those of other experimentalists at other laboratories. Therefore, independent corroboration of experimental results is required before a critical experiment (e.g., one that overthrows an accepted theory) can be trusted.</p><p><strong>Conclusion</strong></p><p>We calculated the uncertainty of the area of table using Monte Carlo Approach given the uncertainties in the measurement of length and breadth of the table. You can tinker with the number of samples and see the results. Also note that every time you run the above code, the result will be different as the random numbers generated by python will be different for each run.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d4298a307a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Raster resampling using Python]]></title>
            <link>https://medium.com/@ch.thombson18/raster-resampling-using-python-3d5fb2c69882?source=rss-769a0b7a5d73------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d5fb2c69882</guid>
            <category><![CDATA[gdal]]></category>
            <category><![CDATA[remote-sensing]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Thombson Chungkham]]></dc:creator>
            <pubDate>Tue, 18 Apr 2023 07:15:35 GMT</pubDate>
            <atom:updated>2023-04-18T07:15:35.203Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7uUqieLI3xxhEFffq7AM7g.png" /></figure><h3>Introduction</h3><p>Raster resampling refers to change of spatial resolution (increasing or decreasing) of the raster dataset. The resampling process calculates the new pixel values from the original digital pixel values in the uncorrected image. There are three common methods for resampling: <strong><em>nearest neighbour, bilinear interpolation, and cubic convolution</em></strong>.</p><h3><strong>Nearest Neighbour</strong></h3><p>The nearest neighbour resampling uses the digital value from the pixel in the original image which is nearest to the new pixel location in the corrected image. This is the fastest interpolation method, which is primarily applied for <em>discrete (categorical)</em> raster data as it does not change the value of the pixel, but may result in some pixel values being duplicated while others are lost.</p><h3><strong>Bilinear</strong></h3><p>Bilinear interpolation resampling takes a weighted average of <em>four pixels</em> in the original image nearest to the new pixel location. The averaging process alters the original pixel values and creates entirely new digital values in the output image. It is recommended for <em>continuous</em> data and it cause some smoothing of the data.</p><h3>Cubic convolution</h3><p>Cubic convolution resampling is based on calculation of a distance weighted average of a block of <em>sixteen pixels</em> from the original image which surround the new output pixel location. As with bilinear interpolation, this method results in completely new pixel values. However, the last two methods both produce images which have a much sharper appearance and avoid the blocky appearance of the nearest neighbour method. The disadvantage of the Cubic method is that its requires more processing time.</p><h3>Necessary Libraries</h3><p>We will use gdal python library for resampling. gdal is a tricky library to install but there is an easy way to install it. Create a new environment first and activate the environment. Type: conda install geopandas and that’s it!!! This will install gdal library as gdal is one of the dependencies of geopandas library. This works in python 3.8.*</p><h3>Data</h3><p>We will use the Arctic Radiation And Turbulence Interaction Study (ARTIST) Sea Ice (ASI) sea ice concentration (SIC) data which is available in GeoTIFF format (.tif). Daily ASI SIC product is published by the <a href="https://seaice.uni-bremen.de/">University of Bremen</a>. The ASI SIC product has a polar stereographic projection at the 6.25 km spatial resolution and referenced to the WGS-84 ellipsoid, with each grid point center latitude and longitude provided with the data. We will be using daily data of 1 February, 2020. The ASI SIC GeoTIFF file can be found <a href="https://seaice.uni-bremen.de/databrowser/#day=1&amp;month=1&amp;year=2020&amp;img=%7B%22image%22%3A%22image-1%22%2C%22product%22%3A%22AMSR%22%2C%22type%22%3A%22nic%22%2C%22region%22%3A%22Arctic%22%7D">here</a>. Let’s open this GeoTIFF file using QGIS software and see the metadata:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oF289Lkf6dL7r9_EnTW9UA.png" /></figure><p>Here, we can see that the pixel size or pixel resolution as <em>x = 6250</em> and <em>y = -6250</em>. Also, the units in the CRS section is in <em>meters</em>.</p><h3><strong>Resampling</strong></h3><pre>#Importing the necessary libraries<br>import glob<br>from osgeo import gdal<br><br>#Reading the GeoTiff files for Resampling<br>data = glob.glob(r&#39;\path\to\file.tif&#39;)<br><br>#ReSampling to 25km using GDAL<br>reproj = gdal.Warp (&#39;ASI_25km_near_1_Feb_2020_25km.tif&#39;, data, dstSRS= &#39;EPSG:3413&#39;, xRes = 25000, yRes =-25000,resampleAlg=&#39;near&#39;)<br>reproj = None</pre><p>Here, we first read the path of the GeoTIFF file using glob library. Replace the <em>\path\to\file.tif </em>with the path of the file directory including the file extension i.e., .tif as shown in the code.</p><p>Resampling is done using gdal.Warp which is used for image reprojection and warping utility. Refer <a href="https://gdal.org/programs/gdalwarp.html">here</a> for more details about gdal.Warp. The <em>‘ASI_25km_near_1_Feb_2020_25km.tif&#39;</em> is the name of our output file (include the extension i.e., .tif) and ‘<em>data’ </em>is our input file<em>. ‘dstSRS’ </em>is the output spatial reference system which is the EPSG code for our output file.<em> Here, EPGS:3413 </em>is the<em> </em>WGS 84 / NSIDC Sea Ice Polar Stereographic North. <em>xRes</em> and <em>yRes</em> are the x-resolution and y-resolution of our output, respectively. Keep in mind that we need to specify these in units of our input file i.e., in meters in our case. So, we set them to 25000 meters. Notice the minus sign in the <em>yRes</em> for convention as y-resolution is always set as negative value. The ‘<em>resampling’</em> is used for resampling method viz, near, bilinear, cubic, lanczos, average, etc. Here, we set it to near which is the nearest neighbor resampling. The variable reproj is set to None to close the file.</p><h3><strong>Output</strong></h3><p>Let’s read the output file using QGIS software and see the metadata.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MK6pBPU5EqktPQQYHJOAvQ.png" /><figcaption>Resampled output metadata.</figcaption></figure><p>We can observe that the output resampled file has pixel size: x = 25000 m and y = -25000 m.</p><h3><strong>Conclusion</strong></h3><p>We resampled a raster image of 6.25 km grid resolution to 25 km using gdal.Warp using nearest neighbor resampling method. That is, we just changed from a finer resolution to a coarser resolution. This is useful when we have to compare two raster images with different resolutions so that both of them are in the same resolution. You can change the resampling method to bilinear, cubic, average, etc., according to your needs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d5fb2c69882" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Map Projection using Python]]></title>
            <link>https://medium.com/@ch.thombson18/map-projection-using-python-77b991bf9954?source=rss-769a0b7a5d73------2</link>
            <guid isPermaLink="false">https://medium.com/p/77b991bf9954</guid>
            <category><![CDATA[remote-sensing]]></category>
            <category><![CDATA[maps]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Thombson Chungkham]]></dc:creator>
            <pubDate>Sat, 25 Feb 2023 04:34:40 GMT</pubDate>
            <atom:updated>2023-02-25T04:34:40.250Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HpYIr7MHqEOyxRm3mAfOBw.png" /><figcaption>SARAL/AltiKa Brightness Temperature projected at Polar Stereographic North.</figcaption></figure><h3>Introduction</h3><p>We are going to project the brightness temperature (Tb) corresponding to 37 GHz of the bi-frequency Passive Microwave Radiometer on-board the <a href="https://www.eoportal.org/satellite-missions/saral">SARAL/AltiKa</a> to <a href="https://nsidc.org/data/user-resources/help-center/guide-nsidcs-polar-stereographic-projection">NSIDC Sea Ice Polar Stereographic North</a>. This <a href="https://medium.com/@ch.thombson18/reading-and-displaying-saral-altika-brightness-temperature-data-using-python-c2fc52eb1eb1">article</a> will get you started with reading Tb data in Network common data form (NetCDF) file using Python. The same data will be used here too for the sake of uniformity, and we will project it to Polar Stereographic North.</p><h3><strong>Pre-requisite knowledge</strong></h3><p>Knowledge of numpy, matplotlib and map projection in general are needed. And That’s it!!!</p><h3>Data</h3><p>The NetCDF file can be found <a href="https://github.com/Thombson747/thombson747.github.io/blob/main/January_2020_tb_ka.nc">here</a>. Again, please refer to the above article for more information about this particular data.</p><h3>Necessary Libraries</h3><p>NetCDF files can be read with a few different Python modules. We will use netCDF4. We will also use numpy, matplotlib and basemap libraries. Basemap is used to plot on map projections (with coastlines and political boundaries) using matplotlib. Refer <a href="https://basemaptutorial.readthedocs.io/en/latest/">this</a> for more details about basemap.</p><h3>Installing Basemap library</h3><p>Create a new virtual environment using conda and type in the following:</p><ul><li>conda config — add channels conda-forge</li><li>conda config — set channel_priority strict</li><li>conda search basemap — channel conda-forge</li><li>conda install -c conda-forge basemap=1.3.6</li><li>conda install basemap basemap-data basemap-data-hires</li></ul><p>The conda search basemap — channel conda-forge will search for the basemap version for your installed python. Check the version and type it here conda install -c conda-forge basemap=*. The latest version as of python 3.8 is 1.3.6 so it is as shown above. That’s it!!!</p><h3>Reading netCDF file</h3><p>We will use the netCDF.Dataset() attribute for reading the netCDF file. Let’s read the netCDF file and explore the variables:</p><pre>#Importing the necessary libraries<br>import numpy as np<br>from netCDF4 import Dataset<br>import matplotlib.pyplot as plt<br>from mpl_toolkits.basemap import Basemap<br><br>#Reading the netCDF file<br>data = Dataset(r&#39;\path\to\file.nc&#39;)<br>print (data)</pre><p>The output:</p><pre>&lt;class &#39;netCDF4._netCDF4.Dataset&#39;&gt;<br>root group (NETCDF4 data model, file format HDF5):<br>    FileType: Z=F(X,Y)<br>    Conventions: CF-1.0<br>    lat_min: -90.0<br>    lat_max: 90.0<br>    lon_min: -180.0<br>    lon_max: 179.66666666666663<br>    dimensions(sizes): lat(541), lon(1080)<br>    variables(dimensions): float64 lat(lat), float64 lon(lon), float64 tb_ka(lon, lat)<br>    groups:</pre><p>As we can see the shape of the variables: lat (541), lon (1080) and tb_ka (1080, 541).</p><p>Let’s read these variables:</p><pre>#Reading the variables<br>lats = data.variables[&#39;lat&#39;][:]<br>lons = data.variables[&#39;lon&#39;][:]<br>tbka = data.variables[&#39;tb_ka&#39;][:]<br>ka = np.rot90(tbka, k=1, axes=(0, 1))</pre><p>The reason why the variable tbka is rotated anti-clockwise will be clearer by referring to this <a href="https://medium.com/@ch.thombson18/reading-and-displaying-saral-altika-brightness-temperature-data-using-python-c2fc52eb1eb1">article</a> again.</p><h3>Map projection using Basemap</h3><p>Before we project tbka on a map, we first need to define a 2-D array for each lats and lons variables just like a map. Notice that the shape of the variable&#39;s lats and lons are not the same with tbka. This can be achieved using <a href="https://numpy.org/doc/stable/reference/generated/numpy.meshgrid.html">np.meshgrid(</a>) and implementing in code as lons, lats = np.meshgrid(lons,lats). In other words, the np.meshgrid function is used to create a rectangular grid out of two given one-dimensional arrays (here, lats and lons)representing the Cartesian indexing or Matrix indexing. We can check the shape of lats and lons by using lats.shape and lons.shape respectively. The output for both gives:</p><pre>(541, 1080)</pre><p>Now, let’s project first to <strong>equirectangular projection</strong> (also called the <strong>equidistant cylindrical projection) </strong>using basemap.</p><pre>lons, lats = np.meshgrid(lons,lats)<br><br>#Setting Equidistant cylindrical projection<br># llcrnrlat,llcrnrlon,urcrnrlat,urcrnrlon<br># are the lat/lon values of the lower left and upper right corners<br># of the map.<br># resolution = &#39;h&#39; means use high resolution coastlines<br>m = Basemap(projection=&#39;cyl&#39;,llcrnrlat=-90,urcrnrlat=90,<br>            llcrnrlon=-180,urcrnrlon=180,resolution=&#39;h&#39;)<br><br>m.drawcoastlines(linewidth=0.2)<br>m.fillcontinents(color=&#39;coral&#39;,lake_color=&#39;aqua&#39;)<br>#draw parallels and meridians.<br>m.drawparallels(np.arange(-80.,81.,20.),labels=[1,0,0,0])<br>m.drawmeridians(np.arange(-180.,181.,20.),labels=[1,0,0,1])<br>#draw map boundary<br>m.drawmapboundary(fill_color=&#39;grey&#39;)<br>x,y=m(lons,lats) #Setting lons in x-axis and lats in y-axis<br>#matplotlib scatter-plot <br>m.scatter(x,y,c=ka,cmap=plt.cm.jet,marker=&#39;.&#39;,s=0.1)<br>#setting colorbar<br>m.colorbar(label=&#39;Brightness Temperature (K)&#39;)<br>plt.rcParams[&quot;figure.dpi&quot;] = 300<br>plt.title (&quot;SARAL/AltiKa Brightness Temperature January 2020&quot;)<br>plt.show()</pre><p>Refer <a href="https://matplotlib.org/basemap/api/basemap_api.html">this</a> for more details about the basemap toolkit and <a href="https://matplotlib.org/basemap/users/cyl.html">this</a> for more about <strong>equidistant cylindrical projection.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*PQLkwai1NO0QCJfkJajmdA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*g1sBB1TWDVv24qC1kSTiBg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*Tz53IZD4HkhSwPolCUy_wg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*CbsYK1TamXeG0OpGU2tiCA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*4SMlFf39hEPRVaMD7V3R_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*NFwwhuMjNJDb4YK3yS39xQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*rBE9sIyKR1sYK85PEd9saw.png" /></figure><p>The output image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2jIpXtpbXHkSyBx9ZDryPg.png" /><figcaption>Equidistant Cylindrical Projection</figcaption></figure><p>As we can see that the image is projected to <strong>equidistant cylindrical projection </strong>but flipped upside down. We can fix this using <a href="https://numpy.org/doc/stable/reference/generated/numpy.flip.html">np.flip()</a> to flip the image in an upright position. Let’s do this and replaced the variable ka with the flipped variable f in the line m.scatter(x,y,c=f,cmap=plt.cm.jet,marker=’.’,s=0.1) as follows:</p><pre>#Flipping the image upright in the axis = 0 i.e., along rows<br>f = np.flip(ka,0)<br><br>#Setting Equidistant cylindrical projection<br># llcrnrlat,llcrnrlon,urcrnrlat,urcrnrlon<br># are the lat/lon values of the lower left and upper right corners<br># of the map.<br># resolution = &#39;h&#39; means use high resolution coastlines<br>m = Basemap(projection=&#39;cyl&#39;,llcrnrlat=-90,urcrnrlat=90,<br>            llcrnrlon=-180,urcrnrlon=180,resolution=&#39;h&#39;)<br><br>m.drawcoastlines(linewidth=0.2)<br>m.fillcontinents(color=&#39;coral&#39;,lake_color=&#39;aqua&#39;)<br>#draw parallels and meridians.<br>m.drawparallels(np.arange(-80.,81.,20.),labels=[1,0,0,0])<br>m.drawmeridians(np.arange(-180.,181.,20.),labels=[1,0,0,1])<br>#draw map boundary<br>m.drawmapboundary(fill_color=&#39;grey&#39;)<br>x,y=m(lons,lats) #Setting lons in x-axis and lats in y-axis<br>#matplotlib scatter-plot <br>m.scatter(x,y,c=f,cmap=plt.cm.jet,marker=&#39;.&#39;,s=0.1)<br>#setting colorbar<br>m.colorbar(label=&#39;Brightness Temperature (K)&#39;)<br>plt.rcParams[&quot;figure.dpi&quot;] = 300<br>plt.title (&quot;SARAL/AltiKa Brightness Temperature January 2020&quot;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LBOWae7NkKQGb8Gr3k2geQ.png" /><figcaption>Equidistant Cylindrical Projection</figcaption></figure><p>Now, let’s project to Polar Stereographic North. Again, refer <a href="https://matplotlib.org/basemap/users/pstere.html">this</a> for more details about the projection.</p><pre>#Setting North Polar Stereographic Projection<br># The longitude lon_0 is at 6-o&#39;clock, and the<br># latitude circle boundinglat is tangent to the edge<br># of the map at lon_0. Default value of lat_ts<br># (latitude of true scale) is pole.<br>m = Basemap(projection=&#39;npstere&#39;,boundinglat=45,lon_0=-45,resolution=&#39;h&#39;)   <br><br>plt.figure(figsize=(12,8))<br>    <br>m.drawcoastlines(linewidth=0.2)<br>m.fillcontinents(color=&#39;coral&#39;,lake_color=&#39;aqua&#39;)<br># draw parallels and meridians.<br>m.drawparallels(np.arange(-80.,81.,20.),labels=[1,0,0,0])<br>m.drawmeridians(np.arange(-180.,181.,20.),labels=[1,0,0,1])<br>m.drawmapboundary(fill_color=&#39;grey&#39;)<br>x,y=m(lons,lats)<br>m.scatter(x,y,c=f,cmap=plt.cm.jet,marker=&#39;.&#39;,s=0.1)<br>m.colorbar(label=&#39;Brightness Temperature (K)&#39;)<br>plt.rcParams[&quot;figure.dpi&quot;] = 300<br>plt.title (&quot;SARAL/AltiKa Brightness Temperature Arctic January 2020&quot;)<br>plt.show()</pre><p>Projection parameters information:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*GUN_3_9PpvmMdrgeJrih5w.png" /></figure><p>The output image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vtcNYkJoZw7rNbXFDsBgvQ.png" /><figcaption>Polar Stereographic North</figcaption></figure><p>We can cut off pole-centered projection at boundinglat (so plot is a circle instead of a square). So, let’s add round=True in the basemap line of code.</p><pre>#Setting North Polar Stereographic Projection<br># The longitude lon_0 is at 6-o&#39;clock, and the<br># latitude circle boundinglat is tangent to the edge<br># of the map at lon_0. Default value of lat_ts<br># (latitude of true scale) is pole.<br>m = Basemap(projection=&#39;npstere&#39;,boundinglat=45,lon_0=-45,resolution=&#39;h&#39;,<br>round = True)   <br><br>plt.figure(figsize=(12,8))<br>    <br>m.drawcoastlines(linewidth=0.2)<br>m.fillcontinents(color=&#39;coral&#39;,lake_color=&#39;aqua&#39;)<br># draw parallels and meridians.<br>m.drawparallels(np.arange(-80.,81.,20.),labels=[1,0,0,0])<br>m.drawmeridians(np.arange(-180.,181.,20.),labels=[1,0,0,1])<br>m.drawmapboundary(fill_color=&#39;grey&#39;)<br>x,y=m(lons,lats)<br>m.scatter(x,y,c=f,cmap=plt.cm.jet,marker=&#39;.&#39;,s=0.1)<br>m.colorbar(label=&#39;Brightness Temperature (K)&#39;)<br>plt.rcParams[&quot;figure.dpi&quot;] = 300<br>plt.title (&quot;SARAL/AltiKa Brightness Temperature Arctic January 2020&quot;)<br>plt.show()</pre><p>The output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QueNPmn7JJNb9YKxMKMpXA.png" /><figcaption>Polar Stereographic North</figcaption></figure><h3><strong>Conclusion</strong></h3><p>We projected the Tb of SARAL/AltiKa to Polar Stereographic North. Feel free to tinker with the options provided by basemap for your convenience with the links provided in the above section.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77b991bf9954" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Converting NetCDF to GeoTiff file using Python]]></title>
            <link>https://medium.com/@ch.thombson18/converting-netcdf-to-geotiff-file-using-python-15ef6e2eaf19?source=rss-769a0b7a5d73------2</link>
            <guid isPermaLink="false">https://medium.com/p/15ef6e2eaf19</guid>
            <category><![CDATA[geotiff]]></category>
            <category><![CDATA[netcdf]]></category>
            <category><![CDATA[remote-sensing]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[cryosphere]]></category>
            <dc:creator><![CDATA[Thombson Chungkham]]></dc:creator>
            <pubDate>Thu, 26 Jan 2023 16:04:26 GMT</pubDate>
            <atom:updated>2023-01-26T16:04:26.730Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h1_iXG0Egf54q12Egk0ikw.png" /></figure><h3><strong>Introduction</strong></h3><p>Here, we are going to use the Arctic sea ice concentration (SIC) data from the ASI (the Arctic Radiation And Turbulence Interaction Study (ARTIST) Sea Ice) at 6.25 km grid resolution in the Arctic. The ASI algorithm computes daily sea ice concentration from the polarization difference of 89 GHz brightness temperature. We are going to convert netCDF file to GeoTIFF using Python. GeoTIFF is based on the TIFF format and is used as an interchange format for georeferenced raster imagery.</p><h3><strong>Data</strong></h3><p>The ASI SIC data is available in netCDF format (.nc). Daily ASI SIC product is published by the <a href="https://seaice.uni-bremen.de/">University of Bremen</a>. The ASI SIC product has a polar stereographic projection at the 6.25 km spatial resolution and referenced to the WGS-84 ellipsoid, with each grid point center latitude and longitude provided with the data. We will be using daily data of 1 February, 2020. The ASI SIC NetCDF file can be found <a href="https://github.com/Thombson747/thombson747.github.io">here</a> as “asi_AMSR2_n6250_20200201_v5.4.nc”.</p><h3><strong>Necessary Libraries</strong></h3><p>NetCDF files can be read with a few different Python modules. We will use netCDF4. Follow <a href="https://medium.com/@ch.thombson18/reading-and-displaying-saral-altika-brightness-temperature-data-using-python-c2fc52eb1eb1">this</a> article for more about using netCDF library. We will also use gdal, numpy, and maplotliblibraries. A little tip for installing gdal — create a new environment and install geopandas library using conda install geopandas and this will automatically install gdal as it is one of the dependencies. The above installation works for python 3.8.* versions.</p><h3>Reading netCDF file</h3><p>We will use the netCDF.Dataset() attribute for reading the netCDF file. Let’s read the netCDF file and explore the variables:</p><pre>#Importing the necessary libraries<br>from osgeo import gdal<br>import numpy as np<br>from netCDF4 import Dataset<br>import matplotlib.pyplot as plt<br>from mpl_toolkits.axes_grid1 import make_axes_locatable<br><br>#Reading the netCDF file<br>data = Dataset(r&#39;\path\to\file.nc&#39;)<br>print (data)</pre><p>The resultant output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*wJI9lO23-Nnh0ad77xuEQA.png" /><figcaption>Metadata of the netCDF file</figcaption></figure><p>Here, ‘x( =1216)’, ‘y (=1792)’ and ‘z (= 0 to 100)’ variables are the number of columns, rows and the values of SIC, respectively.</p><p>First, let’s try to display the netCDF file and see what it looks like just out of curiosity.</p><pre>#Creating a vairable &#39;sic&#39; to store the 2-D array variable &#39;z&#39;<br>sic = data.variables[&#39;z&#39;][:]<br><br>#Flipping the image upright in the axis = 0 i.e., vertically<br>asi_sic = np.flip(sic,0)<br><br>#Displaying the variable &#39;z&#39; i.e., SIC<br>cmmap = plt.cm.get_cmap(&quot;jet&quot;)<br>cmmap.set_bad(&#39;dimgrey&#39;,1.)<br>fig, ax = plt.subplots()<br>divider = make_axes_locatable(ax)<br>cax = divider.append_axes(&#39;right&#39;, size=&#39;5%&#39;, pad=0.05)<br><br>im = ax.imshow(asi_sic, cmap=cmmap, vmin=0, vmax=100)<br><br>fig.colorbar(im, cax=cax, orientation=&#39;vertical&#39;, label=&#39;Sea Ice Concentration (%)&#39;)<br><br>ax.axes.xaxis.set_visible(False)<br>ax.axes.yaxis.set_visible(False)<br>plt.gcf().set_size_inches(15, 15)<br>ax.set_title(&#39;ASI Daily SIC 1 February 2020 Grid 6.25 km&#39;, fontsize=20)<br>fig.set_dpi(300.0)<br>plt.show()</pre><p>The resultant image is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h1_iXG0Egf54q12Egk0ikw.png" /><figcaption>ASI SIC 1 February 2020</figcaption></figure><p>The reason why we flipped the sic variable is because the sic array is an inverted array. You may refer to <a href="https://medium.com/@ch.thombson18/reading-multiple-netcdf-files-and-displaying-monthly-average-data-using-python-913a237ef20a">this</a> article for more details about this particular file.</p><h3>Getting information for Georeferencing</h3><p>First, we need a reference GeoTIFF file for georeferencing the netCDF file. So, we are going to use a GeoTiff file of the same netCDF file which is exported using QGIS software. We will read the georeferencing information using gdal as follows:</p><pre>#Reading GeoTIFF file for GeoReferencing<br>ori_asi6 = gdal.Open (r&quot;\path\to\file.tif&quot;)<br>gt_asi = ori_asi6.GetGeoTransform ()<br>proj_asi = ori_asi6.GetProjection()</pre><p>We can see the variables as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*YirmAEukf1WOSevkqdEQzA.png" /><figcaption>Geo Transform of the GeoTIFF file</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*pU3ICrXyrk7BzhqE12P1TA.png" /><figcaption>Projection information of the GeoTIFF file</figcaption></figure><p>The gt_asi contains georeferencing information in the form of the six rows.</p><blockquote>The second row is the X-direction pixel size (here in meters). Third and fifth rows are the rotational components which in this case are set to zero as the image is not rotated. The sixth row is the Y-direction pixel resolution (which is almost always negative). The first and fourth rows are the coordinates (here in meters) of the upper left corner pixel for the image.</blockquote><p>The proj_asi variable contains the projection information which in our case is <em>NSIDC Sea Ice Polar Stereographic North </em>and the<em> EPSG code is “3413” </em>which is written in the last line at the end of the sentence.</p><h3>Creating GeoTIFF file</h3><p>We are now only left with creating the GeoTIFF file and is done using gdalas follows:</p><pre>#Creating output file<br>driver = gdal.GetDriverByName(&quot;GTiff&quot;)#Getting GeoTIFF driver<br>driver.Register()<br><br>outds_asi = driver.Create (&quot;ASI_625km_SIC_1_Feb_2020.tif&quot;, #Name of the putput file<br>                           xsize = asi_sic.shape[1], #Setting the number of columns<br>                           ysize = asi_sic.shape[0], #Setting the number of rows<br>                           bands = 1, #Setting the number of bands<br>                           eType = gdal.GDT_Float32) #Setting the data type i.e., float 32<br><br>outds_asi.SetGeoTransform(gt_asi) #Setting the geoinformation<br>outds_asi.SetProjection(proj_asi) #Setting the projection information<br>outband_asi = outds_asi.GetRasterBand(1) #Setting the number of bands<br>outband_asi.WriteArray(asi_sic) #Writing the 2-D asi_sic array on the file<br>outband_asi = None #Closing the file<br>outds_asi = None #Closing the file</pre><p>Here, the output file is created using gdal <a href="https://gdal.org/drivers/raster/index.html">driver</a>. The output GeoTIFF file is named “ASI_625km_SIC_1_Feb_2020.tif” with the column and row numbers derived from the 2-D asi_sic array and data type as float 32. The geoinformation and the projection information are also set using gt_asi and proj_asi, respectively. The asi_sic 2-D array is written on the GeoTIFF file using WriteArray option. Finally, closing the files by setting outband_asi and outds_asi to None. This is crucial as the data will not be properly written on the output file without closing the file. And, that’s it!!!</p><p>Let’s check if the output GeoTIFF file is properly created or not by opening the file using QGIS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kbEtyOwtvBwWhE808v7H8Q.png" /><figcaption>Raster information of the GeoTIFF file created.</figcaption></figure><p>As we can see in the raster information and CRS sections that the information that we provided are correctly written on the file.</p><h3>Conclusion</h3><p>We have just learnt how to convert netCDF file to GeoTIFF file using python. GeoTIFF file is much easier to deal with as it contains spatial referencing information in the form of georeferenced raster imagery. Of course, we can use GIS softwares like QGIS, ArcGIS, etc. for creating GeoTIFF file from netCDF but using python, we get to know in depth how the whole process is being done. This is the key tenet behind this article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15ef6e2eaf19" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reading multiple netCDF files and displaying monthly average data using Python]]></title>
            <link>https://medium.com/@ch.thombson18/reading-multiple-netcdf-files-and-displaying-monthly-average-data-using-python-913a237ef20a?source=rss-769a0b7a5d73------2</link>
            <guid isPermaLink="false">https://medium.com/p/913a237ef20a</guid>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[remote-sensing]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[cryosphere]]></category>
            <dc:creator><![CDATA[Thombson Chungkham]]></dc:creator>
            <pubDate>Sat, 17 Dec 2022 12:40:56 GMT</pubDate>
            <atom:updated>2022-12-17T12:40:56.520Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GcnaRMlz5KxBVmKcpGa_Gg.png" /><figcaption>Monthly Average Sea Ice Concentration</figcaption></figure><h3><strong>Introduction</strong></h3><p>Here, we are going to use the Arctic sea ice concentration (SIC) data from the ASI (the Arctic Radiation And Turbulence Interaction Study (ARTIST) Sea Ice). The ASI algorithm computes daily sea ice concentration from the<br>polarization difference of 89 GHz brightness temperature. We are going to to calculate the monthly average of daily ASI SIC and display it using Python.</p><h3><strong>Data</strong></h3><p>The data files are in netCDF format (.nc). Daily ASI SIC product is published by the <a href="https://seaice.uni-bremen.de/">University of Bremen</a>. The ASI SIC product has a polar stereographic projection at the 6.25 km spatial resolution and referenced to the WGS-84 ellipsoid, with each grid point center latitude and longitude provided with the data. We will be using data for the entire month of February, 2020. The ASI SIC netCDF files can be found <a href="https://github.com/Thombson747/thombson747.github.io">here</a> as “Feb 2020 ASI SIC netCDF Files”.</p><h3><strong>Necessary Libraries</strong></h3><p>NetCDF files can be read with a few different Python modules. We will use netCDF4. Follow <a href="https://medium.com/@ch.thombson18/reading-and-displaying-saral-altika-brightness-temperature-data-using-python-c2fc52eb1eb1">this</a> article for more about using netCDF library. We will also use numpy, maplotlib and glob libraries.</p><h3>Reading netCDF file</h3><p>We will use the netCDF.Dataset() attribute for reading the netCDF file. Let’s read a single netCDF file and explore the variables:</p><pre>#Importing the necessary libraries<br>import numpy as np<br>import glob<br>from netCDF4 import Dataset<br>import matplotlib.pyplot as plt<br>from mpl_toolkits.axes_grid1 import make_axes_locatable<br><br>#Reading a single netCDF file<br>data = Dataset(r&#39;\path\to\file.nc&#39;)<br>print (data)</pre><p>The output is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*XMHR1gUC3iBUp4iyvJ29tg.png" /><figcaption>Metadata of the netCDF file.</figcaption></figure><p>Here, ‘x( =1216)’, ‘y (=1792)’ and ‘z (= 0 to 100)’ variables are the number of columns, rows and the values of SIC, respectively.</p><p>First, let’s try to display a daily SIC data i.e., a single netCDF file.</p><pre>#Creating a vairable &#39;sic&#39; to store the 2-D array variable &#39;z&#39;<br>sic = data.variables[&#39;z&#39;][:]<br><br>#Displaying the variable &#39;z&#39; i.e., SIC<br>cmmap = plt.cm.get_cmap(&quot;jet&quot;)<br>cmmap.set_bad(&#39;dimgrey&#39;,1.)<br>fig, ax = plt.subplots()<br>divider = make_axes_locatable(ax)<br>cax = divider.append_axes(&#39;right&#39;, size=&#39;5%&#39;, pad=0.05)<br><br>im = ax.imshow(k, cmap=cmmap, vmin=0, vmax=100)<br><br>fig.colorbar(im, cax=cax, orientation=&#39;vertical&#39;, label=&#39;Sea Ice Concentration (%)&#39;)<br><br>ax.axes.xaxis.set_visible(False)<br>ax.axes.yaxis.set_visible(False)<br>plt.gcf().set_size_inches(15, 15)<br>ax.set_title(&#39;ASI Daily SIC 1st Feb 2020 Grid 6.25 km&#39;, fontsize=20)<br>fig.set_dpi(300.0)<br>plt.show()</pre><p>We get the output plot as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Se4odGBmphmqBx7kX49O2Q.png" /></figure><p>We can see that the output SIC plot is flipped upside down. We can fix this using <a href="https://numpy.org/doc/stable/reference/generated/numpy.flip.html">numpy.flip()</a> to flip the image in an upright position. Let’s do this:</p><pre>#Flipping the image upright in the axis = 0 i.e., vertically<br>f = np.flip(sic,0)</pre><p>The resultant image is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b0qqP1feqUS291NWwk6KKA.png" /><figcaption>1st February ASI SIC.</figcaption></figure><p>Here, what we did was that we flipped the inverted image vertically i.e., in the axis = 0 position.</p><p>Now, let’s try to read the whole netCDF files for the entire month.</p><pre>#File Path<br>w = glob.glob(r&quot;path\to\files\*.nc&quot;)<br>#Creating an empty list to to append the SICs for each netCDF file<br>b = []<br>#Looping through the entire files and creating a variable for each SIC<br>for i in range(len(w)):<br>    exec (f&#39;df{i} = Dataset(w[i])&#39;)<br>    exec (f&quot;sea_ice_concentration{i} = df{i}.variables[&#39;z&#39;][:]&quot;)<br>    exec (f&quot;sic{i} = np.flip(sea_ice_concentration{i},0)&quot;)<br>    exec(f&#39;b.append(sic{i})&#39;)</pre><p>The *.nc in the file path is to read all the netCDF files. Notice the exec() function. It is useful for creating a new variable with a number at the end to keep track for each file. For example, the loop goes from 0 to 28 for this study and each netCDF file variable ‘z’ i.e., SIC values with 2-D arrays are created viz. sic0, sic1,sic2,sic3,…….. sic28. The same goes for ‘df’ and ‘sea_ice_concentration’ variables. The sic0, sic1,sic2,sic3,…….. sic28 variables so created are appended in the list b. The rationale behind this is to calculate the mean or average of all the daily SIC to get a monthly average SIC.</p><p>We are almost done now. We will use <a href="https://numpy.org/doc/stable/reference/generated/numpy.mean.html">numpy.mean()</a> to calculate the mean.</p><pre>#Calculating monthly mean SIC<br>mean_sic = np.mean( np.array(b), axis=0 )<br><br>##Displaying the mean SIC<br>cmmap = plt.cm.get_cmap(&quot;jet&quot;)<br>cmmap.set_bad(&#39;dimgrey&#39;,1.)<br>fig, ax = plt.subplots()<br>divider = make_axes_locatable(ax)<br>cax = divider.append_axes(&#39;right&#39;, size=&#39;5%&#39;, pad=0.05)<br><br>im = ax.imshow(mean_sic, cmap=cmmap, vmin=0, vmax=100)<br><br>fig.colorbar(im, cax=cax, orientation=&#39;vertical&#39;, label=&#39;Sea Ice Concentration (%)&#39;)<br><br>ax.axes.xaxis.set_visible(False)<br>ax.axes.yaxis.set_visible(False)<br>plt.gcf().set_size_inches(15, 15)<br>ax.set_title(&#39;ASI Monthly Average SIC Feb 2020 Grid 6.25km&#39;, fontsize=20)<br>#ax.add_artist(ScaleBar(10000))<br>fig.set_dpi(300.0)<br>plt.show()</pre><p>In the above code, np.array(b) inside the np.mean() is to stacked the 2-D SICs above one another so that the corresponding pixels are aligned equally just like vertically stacking equally sized books upon one another.</p><p>The result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pMMfj5wxoUpef7OIi_SQPw.png" /><figcaption>Monthly Average ASI SIC February 2020</figcaption></figure><h3><strong>Conclusion</strong></h3><p>We have learnt how to plot the monthly average ASI SIC using python. This monthly average SIC data can be used for monthly average analysis of SIC. And eventually, we can use this for estimating sea ice thickness as SIC is one of the major factors for determining sea ice thickness.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=913a237ef20a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Density Plot of SARAL/AltiKa Brightness Temperatures data in the Arctic]]></title>
            <link>https://medium.com/@ch.thombson18/python-density-plot-of-saral-altika-brightness-temperatures-data-in-the-arctic-748dcc17da3b?source=rss-769a0b7a5d73------2</link>
            <guid isPermaLink="false">https://medium.com/p/748dcc17da3b</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[geospatial]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <dc:creator><![CDATA[Thombson Chungkham]]></dc:creator>
            <pubDate>Sun, 21 Aug 2022 17:17:55 GMT</pubDate>
            <atom:updated>2022-08-21T17:17:55.993Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Vyr_A9kabBp0Na1uO2d-w.png" /><figcaption><strong>Density Plot of SARAL/AltiKa Brightness temperatures using Python for February 2016.</strong></figcaption></figure><h3><strong>Introduction</strong></h3><p>On 25 February 2013, India and France jointly launched an oceanographic satellite mission called ‘Satellite with Advanced Research and Global Observation Satellite (Argos) and Ka-band Altimeter (ALtiKa (SARAL/AltiKa). SARAL (SRL) carries a Radar Altimeter operating at Ka-band (35.75 GHz) for measuring the dynamic ocean surface topography. Besides an altimeter, SARAL carries onboard a dual frequency (23.8 GHz and 37 GHz) nadir-looking Passive Microwave Radiometer (PMR), and an ‘Advanced Research and Global Observation Satellite-3’ (ARGOS-3) data collection system. This article will get you started with density plot of PMR data using Python.</p><h3><strong>Data and Study Area</strong></h3><p>The PMR provides brightness temperature (Tb) and operates at two frequencies of 23.8 GHz (Tb_K)and 37 GHz (Tb_Ka), from an altitude of 800 km, with an orbit repeat cycle of 35 days or 501 revolutions. AltiKa points to nadir, while providing observations along the sub-satellite tracks, with about 8 km footprint that are traced at 75 km apart at the equator. The observations are provided along the track at two different temporal resolutions of 1 Hz and 40 Hz, with corresponding spatial resolution of about 6 km and 175 m, respectively. The Level-2 SRL data are provided in nine different types of Geophysical Data Records (GDR), which depending on latency and accuracy, are classified into three families of GDRs. For the present study, we utilize GDR-F Tbs data (source: <a href="https://www.mosdac.gov.in/">www.mosdac.gov.in</a>) for the period February 2020 in the Arctic with a grid resolution of 25km as shown in Fig.1 (a) and (b). As you can see that sea ice and open water have different Tbs due to difference in their emissivities. The csv file containing the Tbs used in this article can be found <a href="https://github.com/Thombson747/thombson747.github.io/blob/main/Tb%20Ka%20K%20with%20NSIDC%20NH%20Mask%20and%20Pole%20hole.txt">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1ZjIHsnFCVwkIsmRSPmQ4g.png" /><figcaption><strong>Fig. 1 (a) Tb_K (23.8 GHz) at 25km grid resolution in the Arctic for February 2016.</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CI5mK-hRcpQAv52o01vkyA.png" /><figcaption><strong>Fig. 1 (b) Tb_Ka (37 GHz) at 25km grid resolution in the Arctic for February 2016.</strong></figcaption></figure><h3><strong>Necessary Python libraries</strong></h3><p>Installing the libraries in a virtual environment is highly recommended. I will not go through on how to install these libraries but I will link them. We will use the following libraries: <a href="https://numpy.org/install/">numpy</a>, <a href="https://pandas.pydata.org/pandas-docs/stable/getting_started/install.html">pandas</a>, <a href="https://matplotlib.org/stable/users/installing/index.html">matplotlib</a> and <a href="https://scipy.org/install/">scipy</a>. And that’s it!</p><h3><strong>Pre-requisite knowledge</strong></h3><p>You need to have a knowledge of how python <a href="https://numpy.org/">numpy</a> ,<a href="https://pandas.pydata.org/">pandas</a> DataFrame and <a href="https://matplotlib.org/stable/index.html">matplotlib</a> work. It is fairly straight forward. Knowledge of these beforehand will make this whole article easier to comprehend. For density plot, we need to have an understanding of <a href="https://en.wikipedia.org/wiki/Kernel_density_estimation">kernel density estimation</a> (KDE) so that we can calculate how much the data points are densely populated. In simple words, we use KDE to estimate the count of the data points. For more details about KDE using python, you can refer <a href="https://www.statsmodels.org/stable/examples/notebooks/generated/kernel_density.html">here</a>.</p><p>Do not worry about implementing KDE in python as we will use <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.gaussian_kde.html">Gaussian KDE</a> module from the scipy library.</p><h3><strong>Plotting Density Plot</strong></h3><p>First of all, we will import all the necessary libraries.</p><pre>import numpy as np<br>import pandas as pd<br>from matplotlib import pyplot as plt<br>from scipy.stats import gaussian_kde</pre><p>Before reading the csv file, let us see what it looks like. The csv file containing our Tbs data was created using the ENVI software.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8foCh9BfNk88j5wkAQVKSg.png" /><figcaption>CSV file containing the Tbs.</figcaption></figure><p>Notice that the first eight rows contain the information of the raster file. We need to skip these rows while reading the csv file. Furthermore, the B1 and B2 columns are our Tb_Ka and Tb_K bands, respectively and so, we will rename them too. We will use pandas to read the csv file and it can be done as follows:</p><pre>df = pd.read_fwf (r&#39;\path\to\file.txt&#39;,skiprows=8,head=None,<br>                  names=[&quot;ID&quot;,&quot;X&quot;,&quot;Y&quot;,&quot;MapX&quot;,&quot;MapY&quot;,&quot;Lat&quot;,&quot;Lon&quot;,&quot;Tb_Ka&quot;,&quot;Tb_K&quot;])</pre><pre>df.drop ([&quot;ID&quot;,&quot;X&quot;,&quot;Y&quot;,&quot;MapX&quot;,&quot;MapY&quot;,&quot;Lat&quot;,&quot;Lon&quot;], axis=1, inplace=True)</pre><p>Here, we use <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_fwf.html">pandas.read_fwf</a> to read a table of fixed-width formatted lines into pandas DataFrame. You might wonder why we did not use <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html">pandas.read_csv</a>. It is because it causes error tokenizing data. The DataFrame is shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VkFqVfY6z0bw2UyFQxWRBw.png" /></figure><p>We will not be needing the columns “ID”, “X”, “Y”, “MapX”, “MapY”, “Lat”, “Lon” so, we will remove them using <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.drop.html">pandas.DataFrame.drop</a> and is accomplished as follows:</p><pre>df.drop ([&quot;ID&quot;,&quot;X&quot;,&quot;Y&quot;,&quot;MapX&quot;,&quot;MapY&quot;,&quot;Lat&quot;,&quot;Lon&quot;], axis=1, inplace=True)</pre><p>And the output DataFrame:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BJ1Wfe8SE95XkDtm_a87TA.png" /></figure><p>In this DataFrame, there are data values with zero Tbs values and it should be regarded as no data value because at the time of the csv file creation, zero Tbs are values of the Pole hole with no data value. Therefore, we need to filter out these values using <a href="https://numpy.org/doc/stable/reference/generated/numpy.where.html">numpy.where</a> and is implemented as:</p><pre>df.Tb_Ka = np.where (df.Tb_Ka == 0, np.nan, df.Tb_Ka)<br>df.Tb_K = np.where (df.Tb_K == 0, np.nan, df.Tb_K)<br>df = df.dropna()</pre><p>Here, we make the zero Tbs values equal to numpy.nan i.e., not a number and drop them using <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.dropna.html">pandas.Series.dropna</a>. In this way, python will automatically skip these data when we plot them later.</p><p>Now, we will start implementing Gaussian KDE of our input data i.e., Tb_Ka and Tb_K, and to achieve this, we have to stack our two input Tbs arrays in a row wise manner using <a href="https://numpy.org/doc/stable/reference/generated/numpy.vstack.html">numpy.vstack</a>. The reason behind this is that the <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.gaussian_kde.html">scipy Gaussian KDE </a>requires the data input to be stacked in row wise:</p><pre>xy = np.vstack([df.Tb_Ka, df.Tb_K])<br>z = gaussian_kde(xy)(xy)</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8YWt-YMR5HiQP2mnh-YLkg.png" /></figure><p>Now, we are left with plotting the density plot. It can be done as:</p><pre>#Plotting<br>fig, ax = plt.subplots()<br>plt.scatter(df.Tb_Ka, df.Tb_K,c=z, s=8,cmap = &#39;rainbow&#39;,marker = &#39;o&#39;)</pre><pre>#Colorbar<br>cb = plt.colorbar(shrink = 0.5,ticks=[np.min(z), np.max(z)])<br>cb.ax.set_yticklabels([&#39;Low&#39;, &#39;High&#39;])<br>cb.ax.tick_params(size=0, labelsize=15)<br>plt.figtext(0.76,0.71,&#39;Density&#39;,size = 20)<br>plt.xticks(size = 20)<br>plt.yticks(size = 20)</pre><pre>#X and Y Labels<br>plt.xlabel(&#39;Tb_Ka (in Kelvin)&#39;,size = 20)<br>plt.ylabel(&#39;Tb_K (in Kelvin)&#39;,size = 20)<br>plt.title (&#39;Density Plot of SARAL/AltiKa Brightness Temperatures February 2016&#39;,size = 22)</pre><pre>#Setting X and Y limits<br>plt.ylim(130, 300)<br>plt.xlim(130, 300)</pre><pre>#Setting figure size and dpi<br>plt.gcf().set_size_inches(18, 15)<br>fig.set_dpi(150.0)<br>plt.show()</pre><p>Output Density plot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Vyr_A9kabBp0Na1uO2d-w.png" /></figure><p>The plotting procedure is self explanatory. In the density plot, we can observe that in the lower Tbs values region (open water), there is high concentration of data points indicated by the red color. The cyan color enveloping the red represents points with lesser density i.e., the points which are less densely populated than the red color. The blue color represents even lesser data points. There is also a cyan region at high Tbs value (sea ice) at around 240K which indicates that there are also large density of data points of sea ice.</p><h3><strong>Conclusion</strong></h3><p>We have learnt how to plot the density plot of Tbs of SARAL/AltiKa data using python. This density plot can be used to find out the tie points of open water and sea ice. And then eventually, we can calculate the sea ice concentration using these tie points.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=748dcc17da3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reading and displaying SARAL/AltiKa Brightness Temperature data using Python]]></title>
            <link>https://medium.com/@ch.thombson18/reading-and-displaying-saral-altika-brightness-temperature-data-using-python-c2fc52eb1eb1?source=rss-769a0b7a5d73------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2fc52eb1eb1</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[remote-sensing]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <dc:creator><![CDATA[Thombson Chungkham]]></dc:creator>
            <pubDate>Sat, 09 Jul 2022 09:07:17 GMT</pubDate>
            <atom:updated>2022-07-09T09:07:17.864Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LYFuVaGdGJMFV2Ngpng5rA.png" /><figcaption>Actual SARAL/AltiKa Brightness Temperature data for January 2020</figcaption></figure><p>On 25 February 2013, India and France jointly launched an oceanographic satellite mission called ‘Satellite with Advanced Research and Global Observation Satellite (Argos) and Ka-band Altimeter (ALtiKa)(SARAL/AltiKa). SARAL (SRL)carries a Radar Altimeter operating at Ka-band (35.75 GHz) for measuring the dynamic ocean surface topography. Besides an altimeter, SARAL carries onboard a dual frequency (23.8 and 37 GHz) nadir-looking Passive Microwave Radiometer (PMR), and an ‘Advanced Research and Global Observation Satellite-3’ (ARGOS-3) data collection system. This article will get you started with reading PMR data in Network common data form (NetCDF) file using Python.</p><h3>Data</h3><p>The PMR provides brightness temperature (Tb) and operates at two frequencies of 23.80 GHz (Tb_K)and 37.00 GHz (Tb_Ka), from an altitude of 800 km, with an orbit repeat cycle of 35 days or 501 revolutions. AltiKa points to nadir, while providing observations along the sub-satellite tracks, with about 8 km footprint that are traced at 75 km apart at the equator. The observations are provided along the track at two different temporal resolutions of 1 Hz and 40 Hz, with corresponding spatial resolution of about 6 km and 175 m, respectively. The Level-2 SRL data are provided in nine different types of Geophysical Data Records (GDR), which depending on latency and accuracy, are classified into three families of GDRs. For the present study, we utilize GDR-F data (source: <a href="http://www.mosdac.gov.in/">www.mosdac.gov.in</a>) for the period January 2020.</p><h3>Data pre-processing</h3><p>Daily SRL Tb data are available and can be processed to monthly data using Basic Radar Altimetry Toolbox (BRAT). All the ascending and the descending orbits of the Tb data are gridded using an operation which computes the mean of the daily along-track Tb for the given month by sub-sampling at each latitude and longitude. BRAT provides the possibility for extrapolating the Tb data to fill in the gaps between tracks. All extrapolated data of the Tb are output in the form of a single NetCDF file format.</p><h3>Installing necessary libraries in Python</h3><p>NetCDF files can be read with a few different Python modules. The most popular are netCDF4 and gdal. We will use netCDF4 for this article. Using the anaconda Python distribution, we will install by simply typing pip install netCDF4or conda install netCDF4at your virtual environment.</p><p>Although we are not going to use gdal, it is a tricky library to install. In order to avoid conflicts with other libraries, I will show you a simple trick how to install gdal in a way that won’t interfere with other libraries. We will accomplish this by installing geopandas library because gdal is one of the dependencies and installing this will save you from all the hustles. Just type conda install geopandas at your virtual environment and voilà!!! Doing this will install all the necessary dependencies like numpy, pandas, matplotlib, etc. including gdal.</p><p>To make sure your netCDF4 module is properly installed, start an interactive session in the terminal (type python and press ‘Enter’). Then import netCDF4 as nc and from osgeo import gdal. And that’s it!</p><h3>Reading a NetCDF Dataset</h3><p>Loading a dataset is simple, just pass a NetCDF file path to netCDF4.Dataset(). For this article, I’m using a file name “January_2020_tb_ka.nc” containing Tb data from <a href="https://github.com/Thombson747/thombson747.github.io">Data</a>.</p><pre>from netCDF4 import Dataset</pre><pre>data = Dataset(r&#39;\path\to\file.nc&#39;)</pre><p>A NetCDF file consists of three basic parts: metadata, dimensions and variables. Variables contain both metadata and data. netCDF4 allows us to access the metadata and data associated with a NetCDF file. More details about NetCDF file is available <a href="https://pro.arcgis.com/en/pro-app/2.8/help/data/multidimensional/what-is-netcdf-data.htm#:~:text=NetCDF%20(network%20Common%20Data%20Form,view%20from%20the%20netCDF%20file.">here</a>.</p><h3>Access Metadata</h3><p>Printing the dataset, data, gives us information about the variables contained in the file and their dimensions.</p><pre>print(data)</pre><p>And the output is shown below:</p><pre>&lt;class &#39;netCDF4._netCDF4.Dataset&#39;&gt;<br>root group (NETCDF4 data model, file format HDF5):<br>    FileType: Z=F(X,Y)<br>    Conventions: CF-1.0<br>    lat_min: -90.0<br>    lat_max: 90.0<br>    lon_min: -180.0<br>    lon_max: 179.83333333333331<br>    dimensions(sizes): lat(1081), lon(2160)<br>    variables(dimensions): float64 lat(lat), float64 lon(lon), float64 tb_ka(lon, lat)<br>    groups:</pre><p>We can see from the above output the information for the file format, data source, data version, citation, dimensions, and variables. The variables we are interested in are lat, lon, and tb_ka(brightness temperature, Tb_Ka). Using these variables, we can find the Tb for January 2020.</p><h3>Accessing Dimensions</h3><p>Each dimension is stored as a dimension class which contains relevant information. We can access the metadata for all dimensions by looping through all available dimensions:</p><pre>for dim in data.dimensions.values():<br>    print(dim)</pre><pre>&lt;class &#39;netCDF4._netCDF4.Dimension&#39;&gt;: name = &#39;lat&#39;, size = 541<br>&lt;class &#39;netCDF4._netCDF4.Dimension&#39;&gt;: name = &#39;lon&#39;, size = 1080</pre><p>Individual dimensions can be accessed by data.dimensions[&#39;lat&#39;].</p><h3>Accessing Variables</h3><p>To access information for a specific variable, we simply type data.variables[‘lat’](latitude) or data.variables[‘lon’](longitude).</p><p>And the output for latitude is shown below:</p><pre>&lt;class &#39;netCDF4._netCDF4.Variable&#39;&gt;<br>float64 lat(lat)<br>    _FillValue: 1.8446744073709552e+19<br>    axis: Y<br>    long_name: lat<br>    standard_name: latitude<br>    units: degrees_north<br>    valid_max: 90.0<br>    valid_min: -90.0<br>unlimited dimensions: <br>current shape = (541,)<br>filling on</pre><p>For longitude:</p><pre>&lt;class &#39;netCDF4._netCDF4.Variable&#39;&gt;<br>float64 lon(lon)<br>    _FillValue: 1.8446744073709552e+19<br>    axis: X<br>    long_name: lon<br>    standard_name: longitude<br>    units: degrees_east<br>    valid_max: 179.66666666666663<br>    valid_min: -180.0<br>unlimited dimensions: <br>current shape = (1080,)<br>filling on</pre><h3>Accessing Data Values</h3><p>The Tb data values are accessed by array indexing, and a numpy masked array is returned. For more information about masked array, see <a href="https://numpy.org/doc/stable/reference/maskedarray.generic.html#:~:text=A%20masked%20array%20is%20the,value%20is%20valid%20or%20not.">masked_array</a>. The variable tb_ka data can be access as follows:</p><pre>print (data.variables[&#39;tb_ka&#39;][:])</pre><p>And the output:</p><pre>masked_array(<br>  data=[[--, --, --, ..., --, --, --],<br>        [--, --, --, ..., --, --, --],<br>        [--, --, --, ..., --, --, --],<br>        ...,<br>        [--, --, --, ..., --, --, --],<br>        [--, --, --, ..., --, --, --],<br>        [--, --, --, ..., --, --, --]],<br>  mask=[[ True,  True,  True, ...,  True,  True,  True],<br>        [ True,  True,  True, ...,  True,  True,  True],<br>        [ True,  True,  True, ...,  True,  True,  True],<br>        ...,<br>        [ True,  True,  True, ...,  True,  True,  True],<br>        [ True,  True,  True, ...,  True,  True,  True],<br>        [ True,  True,  True, ...,  True,  True,  True]],<br>  fill_value=1.8446744073709552e+19)</pre><h3>Displaying Tb_Ka data</h3><p>Now, let’s try to plot the Tb_Ka data using python. The code is simple. We have to just use matplotlib library and that’s pretty much it. The full code is as follows:</p><pre>import matplotlib.pyplot as plt<br>from netCDF4 import Dataset</pre><pre>data = Dataset(r&#39;\path\to\file.nc&#39;)</pre><pre>#Reading the viariables<br>lats = data.variables[&#39;lat&#39;][:]<br>lons = data.variables[&#39;lon&#39;][:]<br>tbka = data.variables[&#39;tb_ka&#39;][:]</pre><pre>#PLotting Tb_Ka<br>fig, (ax) = plt.subplots()</pre><pre>#Creating colourbar for the plot<br>cmmap = plt.cm.jet<br>cmmap.set_bad(&#39;dimgrey&#39;,1.)<br>#Positioning the colourbar</pre><pre>cbar_ax = fig.add_axes([0.92, 0.15, 0.03, 0.7])</pre><pre>im = ax.imshow(tbka, cmap=&#39;jet&#39;)</pre><pre>fig.colorbar(im, cax=cbar_ax, orientation=&#39;vertical&#39;, label=&#39;Brightness Temperature (K)&#39;)</pre><pre>ax.axes.xaxis.set_visible(False)<br>ax.axes.yaxis.set_visible(False)<br>plt.gcf().set_size_inches(15, 15)<br>ax.set_title(&#39;SARAL Tb_Ka&#39;, fontsize=20)<br>fig.set_dpi(100.0)<br>plt.show()</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*tsA4apGeXgTI4F5MAXWLvg.png" /><figcaption>SRL Tb_Ka plot</figcaption></figure><p>Notice that the image is vertical. Don’t worry, we can fix this! We just have to rotate the tb_ka array in counter-clockwise direction by 90 degrees. The most efficient way of doing this is by using the numpy.rot90() module. You can read the details of the module <a href="https://numpy.org/doc/stable/reference/generated/numpy.rot90.html">here</a>. The full code is as follows:</p><pre>import matplotlib.pyplot as plt<br>from netCDF4 import Dataset<br>import numpy as np</pre><pre>data = Dataset(r&#39;\path\to\file.nc&#39;)</pre><pre>#Reading the viariables<br>lats = data.variables[&#39;lat&#39;][:]<br>lons = data.variables[&#39;lon&#39;][:]<br>tbka = data.variables[&#39;tb_ka&#39;][:]</pre><pre>#Rotating the matric by 90 degrees counter-clockwise<br>Ka = np.rot90(tbka, k=1, axes=(0, 1))</pre><pre>#PLotting Tb_Ka<br>fig, (ax) = plt.subplots()<br>cmmap = plt.cm.jet<br>cmmap.set_bad(&#39;dimgrey&#39;,1.)</pre><pre>cbar_ax = fig.add_axes([0.92, 0.15, 0.03, 0.7])</pre><pre>im = ax.imshow(Ka, cmap=&#39;jet&#39;)</pre><pre>fig.colorbar(im, cax=cbar_ax, orientation=&#39;vertical&#39;, label=&#39;Brightness Temperature (K)&#39;)</pre><pre>ax.axes.xaxis.set_visible(False)<br>ax.axes.yaxis.set_visible(False)<br>plt.gcf().set_size_inches(15, 15)<br>ax.set_title(&#39;SARAL Tb_Ka&#39;, fontsize=20)<br>fig.set_dpi(100.0)<br>plt.show()</pre><h3>Output:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LYFuVaGdGJMFV2Ngpng5rA.png" /></figure><h3>Conclusion</h3><p>We have learnt how to read a NetCDF file and plot the Tb of SRL using Python. In this way, we can exploit the power of Python using libraries. Why Python? Python is an open-source and the Python community is large. So, the solution to any problem is readily available. Not to forget the plethora of libraries freely available.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2fc52eb1eb1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Passive Microwave study of Sea Ice]]></title>
            <link>https://medium.com/@ch.thombson18/passive-microwave-study-of-sea-ice-5e2dab1f211c?source=rss-769a0b7a5d73------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e2dab1f211c</guid>
            <category><![CDATA[sea-ice]]></category>
            <category><![CDATA[climate]]></category>
            <category><![CDATA[remote-sensing]]></category>
            <category><![CDATA[cryosphere]]></category>
            <dc:creator><![CDATA[Thombson Chungkham]]></dc:creator>
            <pubDate>Fri, 08 Jul 2022 13:46:32 GMT</pubDate>
            <atom:updated>2022-07-08T13:46:32.848Z</atom:updated>
            <content:encoded><![CDATA[<h3>About Sea Ice</h3><h4>Introduction</h4><p>Sea ice is an important, highly variable feature of tile Earth’s surface, both reflecting and influencing climatic conditions. Sea ice covers approximately 7 percent of the world’s oceans, significantly reduces the amount of solar radiation absorbed at the Earth’s surface, greatly restricts the transfer of heat from the ocean to the atmosphere in winter, and influences global atmospheric and oceanic circulation. The sea ice distribution of both the Northern and the Southern Hemisphere have been documented for the last four decades with the advent of satellites with passive microwave imagers that have provided unique data on these remote regions of the world’s ocean.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TJE3lRCiO9uOuT6P1wEVVQ.png" /><figcaption><strong>Northern Hemisphere Sea Ice Map. Credit: National Snow and Ice Data Center (NSIDC)</strong></figcaption></figure><p>Antarctic sea ice is a highly variable feature of the Earth’s surface. Each year it recedes from its maximum area of approximately 20 million square kilometers in September to its minimum area of approximately 4 million square kilometers in February. As a variable ice feature, the area of seasonal sea ice is exceeded only by the seasonal snow cover on the continents in the Northern Hemisphere. Although the aerial extent of winter sea ice in the southern ocean is 50 percent larger than the area of permanent ice cover on the continent, the volume of sea ice is 1000 times less than that of continental ice. These general characteristics of Antarctic sea ice were known decades before the advent of observations from space, but with recent satellite microwave sensors, not only the extent of the ice but also the area of open water in polynyas and leads within the ice pack has been obtained.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c339d_jfIPcGC5GKpahNoQ.png" /><figcaption><strong>Southern Hemisphere Sea Ice Map. Credit: National Snow and Ice Data Center (NSIDC)</strong></figcaption></figure><p>The variable year-to-year positions of the sea ice edge at its winter maxima and its summer minima have often been used as indicators of changes in global climate. Generally, sea ice extends farther from the poles during colder climatic periods (Lamb,1972) such as the Little Ice Age in the eighteenth century and the last glaciation of the Pleistocene epoch, which ended approximately 10,000 years ago. For the distant past, information on the location of the ice edge has been deduced from the geologic record in sea-floor sediments. For the past several centuries, this information has been supplemented by historical records for select locations such as Iceland. For recent decades, a more detailed record of sea ice has been obtained from numerous ship, aircraft, and satellite observations.</p><p>The relationship between climate and sea ice is complex. Regional and global changes in ice extent influence oceanic and atmospheric conditions, which in turn influence the distribution of sea ice. The freezing of ocean water to form sea ice, the deformation of sea ice by winds and ocean currents, and the melting of sea ice are all interactive processes. The physical processes involve sensible and latent heat transfer, wind stress, ocean heat flux, solar radiation, cloud cover, ocean currents, ice drift, and other factors. In spring and summer, for example, the presence of highly reflective sea ice greatly decreases the amount of solar radiation absorbed at the Earth’s surface. In winter, the sea ice acts as an insulator between the cold polar atmosphere and the relatively warm ocean surface, greatly restricting exchanges of heat and mass between the ocean and the atmosphere.</p><h4>What is sea ice?</h4><p>Sea ice is simply frozen ocean water. It forms, grows, and melts in the ocean. In contrast, icebergs, glaciers, ice sheets, and ice shelves all originate on land. Sea ice occurs in both the Arctic and Antarctic. In the Northern Hemisphere, it can currently exist as far south as Bohai Bay, China (approximately 38 degrees north latitude), which is actually about 700 kilometers (435 miles) closer to the Equator than it is to the North Pole. In the Southern Hemisphere, sea ice only develops around Antarctica, occurring as far north as 55 degrees south latitude.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/1*l8RK6V1iJRc9qvAf7hJrZw.jpeg" /><figcaption><strong>On the third trip out with the helicopter, the team come across an overlapping blend of nila and smooth snow-covered ice, with breakage around the edges, and fracturing on the surface</strong>. <strong>— <em>Credit: NSIDC</em></strong></figcaption></figure><p>Sea ice grows during the winter months and melts during the summer months, but some sea ice remains all year in certain regions. About 15 percent of the world’s oceans are covered by sea ice during part of the year.</p><h4>Why is sea ice so important, and why do scientists study it?</h4><p>Even though sea ice occurs primarily in the polar regions, it influences our global climate. Sea ice has a bright surface, so much of the sunlight that strikes it is reflected back into space. As a result, areas covered by sea ice don’t absorb much solar energy, so temperatures in the polar regions remain relatively cool. If gradually warming temperatures melt sea ice over time, fewer bright surfaces are available to reflect sunlight back into space, more solar energy is absorbed at the surface, and temperatures rise further. This chain of events starts a cycle of warming and melting. This cycle is temporarily halted when the dark days of the polar winter return, but it starts again in the following spring. Even a small increase in temperature can lead to greater warming over time, making the polar regions the most sensitive areas to climate change on Earth.</p><p>Sea ice also affects the movement of ocean waters. When sea ice forms, most of the salt is pushed into the ocean water below the ice, although some salt may become trapped in small pockets between ice crystals. Water below sea ice has a higher concentration of salt and is more dense than surrounding ocean water, and so it sinks. In this way, sea ice contributes to the ocean’s global “conveyor-belt” circulation. Cold, dense, polar water sinks and moves along the ocean bottom toward the equator, while warm water from mid-depth to the surface travels from the equator toward the poles. Changes in the amount of sea ice can disrupt normal ocean circulation, thereby leading to changes in global climate.</p><p>Too much or too little sea ice can be a problem for wildlife and people who hunt and travel in polar regions. In the Arctic, sea ice can be an obstacle to normal shipping routes through the Northern Sea route and Northwest Passage.</p><h3>What is the difference between sea ice and icebergs, glaciers, and lake ice?</h3><p>The most basic difference is that sea ice forms from salty ocean water, whereas icebergs, glaciers, and lake ice form from fresh water or snow. Sea ice grows, forms, and melts strictly in the ocean. Glaciers are considered land ice, and icebergs are chunks of ice that break off of glaciers and fall into the ocean. Lake ice is made from fresh water and freezes as a smooth layer, unlike sea ice, which develops into various forms and shapes because of the constant turbulence of ocean water.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BfUrHAamNaFGxVFnv6le9g.jpeg" /><figcaption><strong>This photo was taken during a flight over the Antarctic Ice Sheet. Bird Glacier is visible in the background, with Darwin Glacier in the foreground. — Credit: NSIDC</strong></figcaption></figure><p>The process by which sea ice forms is also different from that of lake or river ice. Fresh water is unlike most substances because it becomes less dense as it nears the freezing point. This difference in density explains why ice cubes float in a glass of water. Very cold, low-density fresh water stays at the surface of lakes and rivers, forming an ice layer on the top.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LG1iGIpOT_Qns2rOI10KOg.jpeg" /><figcaption><strong>An iceberg. Photo Credit: NSIDC</strong></figcaption></figure><p>In contrast to fresh water, the salt in ocean water causes the density of the water to increase as it nears the freezing point, and very cold ocean water tends to sink. As a result, sea ice forms slowly, compared to freshwater ice, because salt water sinks away from the cold surface before it cools enough to freeze. Furthermore, other factors cause the formation of sea ice to be a slow process. The freezing temperature of salt water is lower than fresh water; ocean temperatures must reach -1.8 degrees Celsius (28.8 degrees Fahrenheit) to freeze. Because oceans are so deep, it takes longer to reach the freezing point, and generally, the top 100 to 150 meters (300 to 450 feet) of water must be cooled to the freezing temperature for ice to form.</p><h3>Can you drink melted sea ice?</h3><p>New ice is usually very salty because it contains concentrated droplets called brine that are trapped in pockets between the ice crystals, and so it would not make good drinking water. As ice ages, the brine eventually drains through the ice, and by the time it becomes multiyear ice, nearly all of the brine is gone. Most multiyear ice is fresh enough that someone could drink its melted water. In fact, multiyear ice often supplies the fresh water needed for polar expeditions.</p><h3>Remote Sensing: Introduction</h3><p>Remote sensing, in simplest terms, means viewing something from a distance rather than by direct contact. A handheld camera is an example of a remote sensing instrument. In terms of Earth science, remote sensing refers to the ability of satellites to detect <em>electromagnetic radiation</em> from features on the Earth’s surface or in the atmosphere. Solar energy that reaches the Earth is composed of many kinds of radiation, including light that is visible to people, thermal infrared, microwave, radar, and X-rays. Every substance with a temperature greater than <em>absolute zero</em> (-273 degrees Celsius, or -459 degrees Fahrenheit) emits some form of electromagnetic radiation. Some satellite sensors detect visible light reflected from the Earth’s surface or atmosphere, and others detect radiation emitted from the Earth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rfZBA7ZWfgmT7_6SqQ4F9g.png" /><figcaption><strong>Image courtesy of NASA.</strong></figcaption></figure><p>Satellites can easily measure sea ice in the visible, infrared, and microwave regions of the electromagnetic spectrum. However, there are advantages and disadvantages to each type of radiation. None of the spectral regions allow scientists to optimally view sea ice in all conditions. The following section describes about passive microwave in more detail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C7BzpSL4gsmzWtlY_3ovLQ.png" /><figcaption><strong>This image of Antarctica was captured by the Advanced Microwave Scanning Radiometer-2 (AMSR2) sensor aboard the Global Change Observation Mission 1st — Water “SHIZUKU” (GCOM-W1) satellite on September 16, 2020. Ice concentration is color coded, with higher concentrations in white, and lower concentrations in dark purple.<br> — Credit: University of Bremen Sea Ice</strong></figcaption></figure><p>Objects at the Earth’s surface emit not only infrared radiation; they also emit microwaves at relatively low energy levels. When a sensor detects microwave radiation naturally emitted by the Earth, that radiation is called <em>passive microwave</em>. Clouds do not emit much microwave radiation, compared to sea ice. Thus, microwaves can penetrate clouds and be used to detect sea ice during the day and night, regardless of cloud cover.</p><p>Microwave emission is not as strongly tied to the temperature of an object, compared to infrared. Instead, the object’s <em>physical properties</em>, such as atomic composition and crystalline structure, determine the amount of microwave radiation it emits. The crystalline structure of ice typically emits more microwave energy than the liquid water in the ocean. Thus, sensors that detect passive microwave radiation can easily distinguish sea ice from ocean.</p><p>A major drawback to measuring passive microwave radiation is that the energy level is quite low. As a result, the radiation must be collected over a larger region. Details of the sea ice, such as leads, are not easily detected.</p><p>Because of their ability to detect sea ice through clouds during the day and night, passive microwave sensors provide nearly complete images of all sea ice-covered regions every day. These sensors have provided the most complete, long-term observations of sea ice, allowing scientists to detect notable changes in Arctic sea ice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XsshpiFmBaZxXZVImZTGDA.png" /><figcaption><strong>Arctic sea ice concentration using AMSE2 data with grid resolution of 6.25 km on January 16, 2020. Credit: University of Bremen</strong></figcaption></figure><p>Sea ice observations from passive microwave sensors began in 1972 with the Electrically Scanning Microwave Radiometer (ESMR) aboard NOAA’s Nimbus-5 satellite. In 1978, NASA’s Scanning Multichannel Microwave Radiometer (SMMR) provided detailed, reliable information about sea ice. In 1987, a series of DMSP Special Sensor Microwave/Imager (SSM/I) sensors continued the <em>time series</em>, or long-term record, of sea ice data through present. In 2002, NASA launched the Aqua satellite, which carried the Advanced Microwave Scanning Radiometer-Earth Observing System (AMSR-E) sensor. JAXA followed AMSR-E with the AMSR-2 mission launched in 2012. The system’s improved technology complemented the time series of sea ice data. ESMR, SMMR, SSM/I, AMSR-E, and AMSR-2 sea ice data are available from NSIDC.</p><h3>Conclusion</h3><p>Hopefully, you now know somewhat about passive microwave study of sea ice.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e2dab1f211c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>