{ "cells": [ { "cell_type": "markdown", "id": "03cfc89b-5ee1-49c2-8bc9-ca88c00eb63b", "metadata": {}, "source": [ "# examples" ] }, { "cell_type": "code", "execution_count": 1, "id": "9f901d61-adf5-4ad2-a721-b92fb8555642", "metadata": {}, "outputs": [], "source": [ "# import dependencies\n", "import xradarsat2" ] }, { "cell_type": "code", "execution_count": 2, "id": "84c1a31d-c27c-4614-8a39-f4dca2801bf6", "metadata": {}, "outputs": [], "source": [ "# Specify the directory that contains the level 1 files\n", "folder_path = \"/home/datawork-cersat-public/cache/project/sarwing/data/RS2/L1/VV_VH/2020/234/RS2_OK123649_PK1086794_DK1033082_SCWA_20200821_133300_VV_VH_SGF\"" ] }, { "cell_type": "code", "execution_count": 3, "id": "90fb68ff-2c19-4432-8d95-98159ee546a8", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.DatasetView>\n",
       "Dimensions:  ()\n",
       "Data variables:\n",
       "    *empty*\n",
       "Attributes:\n",
       "    product_path:           /home/datawork-cersat-public/cache/project/sarwin...\n",
       "    satellite:              RADARSAT-2\n",
       "    inputDatasetId:         /Fred/RSAT-2/525985P\n",
       "    rawDataStartTime:       2020-08-21T13:33:00.289027\n",
       "    satelliteHeight_units:  m\n",
       "    satelliteHeight:        793996.3316241935
" ], "text/plain": [ "DataTree('None', parent=None)\n", "│ Dimensions: ()\n", "│ Data variables:\n", "│ *empty*\n", "│ Attributes:\n", "│ product_path: /home/datawork-cersat-public/cache/project/sarwin...\n", "│ satellite: RADARSAT-2\n", "│ inputDatasetId: /Fred/RSAT-2/525985P\n", "│ rawDataStartTime: 2020-08-21T13:33:00.289027\n", "│ satelliteHeight_units: m\n", "│ satelliteHeight: 793996.3316241935\n", "├── DataTree('orbitAndAttitude')\n", "│ Dimensions: (timeStamp: 11)\n", "│ Coordinates:\n", "│ * timeStamp (timeStamp) datetime64[ns] 2020-08-21T13:32:59.965779 ... 2020...\n", "│ Data variables:\n", "│ yaw (timeStamp) float64 3.62 3.634 3.647 3.657 ... 3.713 3.721 3.731\n", "│ roll (timeStamp) float64 -29.8 -29.8 -29.8 -29.8 ... -29.8 -29.8 -29.8\n", "│ pitch (timeStamp) float64 0.00105 0.0002288 ... -0.0002198 0.0002899\n", "│ xPosition (timeStamp) float64 -2.264e+06 -2.283e+06 ... -2.45e+06\n", "│ yPosition (timeStamp) float64 -6.252e+06 -6.267e+06 ... -6.386e+06\n", "│ zPosition (timeStamp) float64 2.681e+06 2.629e+06 ... 2.205e+06 2.151e+06\n", "│ xVelocity (timeStamp) float64 -2.523e+03 -2.507e+03 ... -2.348e+03\n", "│ yVelocity (timeStamp) float64 -2.024e+03 -1.97e+03 ... -1.476e+03\n", "│ zVelocity (timeStamp) float64 -6.824e+03 -6.846e+03 ... -7.024e+03\n", "│ Attributes:\n", "│ attitudeDataSource: Downlink\n", "│ attitudeOffsetsApplied: true\n", "│ Description: Attitude Information Data Store. Orbit Informati...\n", "├── DataTree('geolocationGrid')\n", "│ Dimensions: (line: 11, pixel: 11)\n", "│ Coordinates:\n", "│ * line (line) int64 0 1018 2037 3056 4074 5093 6112 7130 8149 9168 10187\n", "│ * pixel (pixel) int64 0 1044 2088 3133 4177 ... 6266 7310 8355 9399 10444\n", "│ Data variables:\n", "│ latitude (line, pixel) float64 23.47 23.38 23.3 ... 18.24 18.14 18.04\n", "│ longitude (line, pixel) float64 -117.3 -116.8 -116.3 ... -113.8 -113.3\n", "│ height (line, pixel) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n", "│ Attributes: (12/13)\n", "│ productFormat: GeoTIFF\n", "│ outputMediaInterleaving: BSQ\n", "│ rasterAttributes_dataType: Magnitude Detected\n", "│ rasterAttributes_bitsPerSample_dataStream: Magnitude\n", "│ rasterAttributes_bitsPerSample_value: 16\n", "│ rasterAttributes_numberOfSamplesPerLine: 10445\n", "│ ... ...\n", "│ rasterAttributes_sampledPixelSpacing_units: m\n", "│ rasterAttributes_sampledPixelSpacing_value: 50.0\n", "│ rasterAttributes_sampledLineSpacing_units: m\n", "│ rasterAttributes_sampledLineSpacing_value: 50.0\n", "│ rasterAttributes_lineTimeOrdering: Increasing\n", "│ rasterAttributes_pixelTimeOrdering: Decreasing\n", "├── DataTree('imageGenerationParameters')\n", "│ ├── DataTree('doppler')\n", "│ │ ├── DataTree('dopplerCentroid')\n", "│ │ │ Dimensions: (timeOfDopplerCentroidEstimate: 6,\n", "│ │ │ n-Coefficients: 5)\n", "│ │ │ Coordinates:\n", "│ │ │ * timeOfDopplerCentroidEstimate (timeOfDopplerCentroidEstimate) datetime64[ns] ...\n", "│ │ │ * n-Coefficients (n-Coefficients) int64 0 1 2 3 4\n", "│ │ │ Data variables:\n", "│ │ │ dopplerAmbiguity (timeOfDopplerCentroidEstimate) int64 0 ...\n", "│ │ │ dopplerAmbiguityConfidence (timeOfDopplerCentroidEstimate) float64 ...\n", "│ │ │ dopplerCentroidReferenceTime (timeOfDopplerCentroidEstimate) float64 ...\n", "│ │ │ dopplerCentroidPolynomialPeriod (timeOfDopplerCentroidEstimate) float64 ...\n", "│ │ │ dopplerCentroidCoefficients (timeOfDopplerCentroidEstimate, n-Coefficients) float64 ...\n", "│ │ │ dopplerCentroidConfidence (timeOfDopplerCentroidEstimate) float64 ...\n", "│ │ │ Attributes:\n", "│ │ │ Description: Doppler Centroid Data Store\n", "│ │ └── DataTree('dopplerRateValues')\n", "│ │ Dimensions: (dopplerRateReferenceTime: 1,\n", "│ │ n-RateValuesCoefficients: 3)\n", "│ │ Coordinates:\n", "│ │ * dopplerRateReferenceTime (dopplerRateReferenceTime) float64 0.005571\n", "│ │ * n-RateValuesCoefficients (n-RateValuesCoefficients) int64 0 1 2\n", "│ │ Data variables:\n", "│ │ dopplerRateValues (dopplerRateReferenceTime, n-RateValuesCoefficients) float64 ...\n", "│ │ Attributes:\n", "│ │ Description: Doppler Rate Values Data Store.\n", "│ └── DataTree('chirp')\n", "│ Dimensions: (pole: 2, n-amplitudeCoefficients: 4,\n", "│ n-phaseCoefficients: 4)\n", "│ Coordinates:\n", "│ * pole (pole) \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.DatasetView>\n",
       "Dimensions:                         (beam: 4, pole: 2, NbOfNoiseLevelValues: 99)\n",
       "Coordinates:\n",
       "  * beam                            (beam) <U3 'W1' 'W2' 'W30' 'S7'\n",
       "  * pole                            (pole) <U2 'VH' 'VV'\n",
       "Dimensions without coordinates: NbOfNoiseLevelValues\n",
       "Data variables:\n",
       "    pulsesReceivedPerDwell          (beam) int64 58 58 58 58\n",
       "    numberOfPulseIntervalsPerDwell  (beam) int64 65 66 65 67\n",
       "    rank                            (beam) int64 7 8 7 9\n",
       "    settableGain                    (beam, pole) float64 -1.0 -1.0 ... -1.0 -1.0\n",
       "    pulseRepetitionFrequency        (beam) float64 1.283e+03 ... 1.295e+03\n",
       "    samplesPerEchoLine              (beam) int64 6768 7920 7944 7320\n",
       "    noiseLevelValues_BetaNought     (NbOfNoiseLevelValues) float64 -27.3 ... ...\n",
       "    noiseLevelValues_SigmaNought    (NbOfNoiseLevelValues) float64 -28.5 ... ...\n",
       "    noiseLevelValues_Gamma          (NbOfNoiseLevelValues) float64 -26.65 ......\n",
       "Attributes: (12/20)\n",
       "    acquisitionType:             ScanSAR Wide\n",
       "    beams:                       ['W1', 'W2', 'W30', 'S7']\n",
       "    polarizations:               ['VV', 'VH']\n",
       "    pulses:                      11.58\n",
       "    radarCenterFrequency_units:  Hz\n",
       "    radarCenterFrequency:        5404999242.769673\n",
       "    ...                          ...\n",
       "    adcSamplingRate_units:       Hz\n",
       "    adcSamplingRate:             12667968.75\n",
       "    yawSteeringFlag:             YawSteeringOn\n",
       "    geodeticFlag:                Off-Geocentric\n",
       "    rawBitsPerSample:            4\n",
       "    Description:                 Radar Parameters Data Store. Information des...
" ], "text/plain": [ "\n", "Dimensions: (beam: 4, pole: 2, NbOfNoiseLevelValues: 99)\n", "Coordinates:\n", " * beam (beam) \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.DatasetView>\n",
       "Dimensions:  ()\n",
       "Data variables:\n",
       "    *empty*\n",
       "Attributes:\n",
       "    product_path:           /home/datawork-cersat-public/cache/project/sarwin...\n",
       "    satellite:              RADARSAT-2\n",
       "    inputDatasetId:         /Fred/RSAT-2/525985P\n",
       "    rawDataStartTime:       2020-08-21T13:33:00.289027\n",
       "    satelliteHeight_units:  m\n",
       "    satelliteHeight:        793996.3316241935
" ], "text/plain": [ "DataTree('None', parent=None)\n", "│ Dimensions: ()\n", "│ Data variables:\n", "│ *empty*\n", "│ Attributes:\n", "│ product_path: /home/datawork-cersat-public/cache/project/sarwin...\n", "│ satellite: RADARSAT-2\n", "│ inputDatasetId: /Fred/RSAT-2/525985P\n", "│ rawDataStartTime: 2020-08-21T13:33:00.289027\n", "│ satelliteHeight_units: m\n", "│ satelliteHeight: 793996.3316241935\n", "├── DataTree('orbitAndAttitude')\n", "│ Dimensions: (timeStamp: 11)\n", "│ Coordinates:\n", "│ * timeStamp (timeStamp) datetime64[ns] 2020-08-21T13:32:59.965779 ... 2020...\n", "│ Data variables:\n", "│ yaw (timeStamp) float64 3.62 3.634 3.647 3.657 ... 3.713 3.721 3.731\n", "│ roll (timeStamp) float64 -29.8 -29.8 -29.8 -29.8 ... -29.8 -29.8 -29.8\n", "│ pitch (timeStamp) float64 0.00105 0.0002288 ... -0.0002198 0.0002899\n", "│ xPosition (timeStamp) float64 -2.264e+06 -2.283e+06 ... -2.45e+06\n", "│ yPosition (timeStamp) float64 -6.252e+06 -6.267e+06 ... -6.386e+06\n", "│ zPosition (timeStamp) float64 2.681e+06 2.629e+06 ... 2.205e+06 2.151e+06\n", "│ xVelocity (timeStamp) float64 -2.523e+03 -2.507e+03 ... -2.348e+03\n", "│ yVelocity (timeStamp) float64 -2.024e+03 -1.97e+03 ... -1.476e+03\n", "│ zVelocity (timeStamp) float64 -6.824e+03 -6.846e+03 ... -7.024e+03\n", "│ Attributes:\n", "│ attitudeDataSource: Downlink\n", "│ attitudeOffsetsApplied: true\n", "│ Description: Attitude Information Data Store. Orbit Informati...\n", "├── DataTree('geolocationGrid')\n", "│ Dimensions: (line: 11, pixel: 11)\n", "│ Coordinates:\n", "│ * line (line) int64 0 1018 2037 3056 4074 5093 6112 7130 8149 9168 10187\n", "│ * pixel (pixel) int64 0 1044 2088 3133 4177 ... 6266 7310 8355 9399 10444\n", "│ Data variables:\n", "│ latitude (line, pixel) float64 23.47 23.38 23.3 ... 18.24 18.14 18.04\n", "│ longitude (line, pixel) float64 -117.3 -116.8 -116.3 ... -113.8 -113.3\n", "│ height (line, pixel) float64 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0\n", "│ Attributes: (12/13)\n", "│ productFormat: GeoTIFF\n", "│ outputMediaInterleaving: BSQ\n", "│ rasterAttributes_dataType: Magnitude Detected\n", "│ rasterAttributes_bitsPerSample_dataStream: Magnitude\n", "│ rasterAttributes_bitsPerSample_value: 16\n", "│ rasterAttributes_numberOfSamplesPerLine: 10445\n", "│ ... ...\n", "│ rasterAttributes_sampledPixelSpacing_units: m\n", "│ rasterAttributes_sampledPixelSpacing_value: 50.0\n", "│ rasterAttributes_sampledLineSpacing_units: m\n", "│ rasterAttributes_sampledLineSpacing_value: 50.0\n", "│ rasterAttributes_lineTimeOrdering: Increasing\n", "│ rasterAttributes_pixelTimeOrdering: Decreasing\n", "├── DataTree('imageGenerationParameters')\n", "│ ├── DataTree('doppler')\n", "│ │ ├── DataTree('dopplerCentroid')\n", "│ │ │ Dimensions: (timeOfDopplerCentroidEstimate: 6,\n", "│ │ │ n-Coefficients: 5)\n", "│ │ │ Coordinates:\n", "│ │ │ * timeOfDopplerCentroidEstimate (timeOfDopplerCentroidEstimate) datetime64[ns] ...\n", "│ │ │ * n-Coefficients (n-Coefficients) int64 0 1 2 3 4\n", "│ │ │ Data variables:\n", "│ │ │ dopplerAmbiguity (timeOfDopplerCentroidEstimate) int64 0 ...\n", "│ │ │ dopplerAmbiguityConfidence (timeOfDopplerCentroidEstimate) float64 ...\n", "│ │ │ dopplerCentroidReferenceTime (timeOfDopplerCentroidEstimate) float64 ...\n", "│ │ │ dopplerCentroidPolynomialPeriod (timeOfDopplerCentroidEstimate) float64 ...\n", "│ │ │ dopplerCentroidCoefficients (timeOfDopplerCentroidEstimate, n-Coefficients) float64 ...\n", "│ │ │ dopplerCentroidConfidence (timeOfDopplerCentroidEstimate) float64 ...\n", "│ │ │ Attributes:\n", "│ │ │ Description: Doppler Centroid Data Store\n", "│ │ └── DataTree('dopplerRateValues')\n", "│ │ Dimensions: (dopplerRateReferenceTime: 1,\n", "│ │ n-RateValuesCoefficients: 3)\n", "│ │ Coordinates:\n", "│ │ * dopplerRateReferenceTime (dopplerRateReferenceTime) float64 0.005571\n", "│ │ * n-RateValuesCoefficients (n-RateValuesCoefficients) int64 0 1 2\n", "│ │ Data variables:\n", "│ │ dopplerRateValues (dopplerRateReferenceTime, n-RateValuesCoefficients) float64 ...\n", "│ │ Attributes:\n", "│ │ Description: Doppler Rate Values Data Store.\n", "│ └── DataTree('chirp')\n", "│ Dimensions: (pole: 2, n-amplitudeCoefficients: 4,\n", "│ n-phaseCoefficients: 4)\n", "│ Coordinates:\n", "│ * pole (pole) " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Add digital numbers to the datatree and display it\n", "dt = xradarsat2.load_digital_number(\n", " chunks={\"line\": 5000, \"sample\": 5000},\n", " dt=dt,\n", " resolution={\"line\": 50, \"sample\": 50},\n", ")\n", "dt" ] } ], "metadata": { "kernelspec": { "display_name": "radarsat2_test", "language": "python", "name": "radarsat2_test" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.8" } }, "nbformat": 4, "nbformat_minor": 5 }