Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Load, Subset, and Reproject NISAR GCOV Data with ISCE3


This notebook demonstrates how to load GCOV data with ISCE3’s NISAR Product Reader.


Overview

  1. Prerequisites

  2. Search and download a GCOV product

  3. Load an HDF5 dataset as a GenericProduct.GCOV object

  4. View the GCOV metadata

  5. Load a backscatter or covariance image dataset

  6. Subset the data by index

  7. Reproject the data

  8. Calculate statistics and transformations on the data

  9. Plot the data

  10. Summary

  11. Resources and references


1. Prerequisites

PrerequisiteImportanceNotes
The software environment for this cookbook must be installedNecessary
  • Rough Notebook Time Estimate: 3 minutes


2. Search and download a GCOV product

import os
import asf_search as asf
from datetime import datetime
from getpass import getpass

session = asf.ASFSession()
session.auth_with_creds(input('EDL Username'), getpass('EDL Password'))

start_date = datetime(2025, 11, 22)
end_date = datetime(2025, 12, 5)
area_of_interest = "POLYGON((40.9131 12.3904,41.8891 12.3904,41.8891 13.2454,40.9131 13.2454,40.9131 12.3904))" # POINT or POLYGON as WKT (well-known-text)

opts=asf.ASFSearchOptions(**{
    "maxResults": 250,
    "intersectsWith": area_of_interest,
    "start": start_date,
    "end": end_date,
    "processingLevel": [
        "GCOV"
    ],
    "dataset": [
        "NISAR"
    ],
    "productionConfiguration": [
        "PR"
    ],
    'session': session,
})

response = asf.search(opts=opts)
pattern = r'^(?!.*QA_STATS).*'
hdf5_files = response.find_urls(extension='.h5', pattern=pattern, directAccess=False)
hdf5_files
EDL Username aflewandowski
EDL Password ········
['https://nisar.asf.earthdatacloud.nasa.gov/NISAR/NISAR_L2_GCOV_BETA_V1/NISAR_L2_PR_GCOV_005_172_A_008_2005_DHDH_A_20251122T024618_20251122T024652_X05007_N_F_J_001/NISAR_L2_PR_GCOV_005_172_A_008_2005_DHDH_A_20251122T024618_20251122T024652_X05007_N_F_J_001.h5', 'https://nisar.asf.earthdatacloud.nasa.gov/NISAR/NISAR_L2_GCOV_BETA_V1/NISAR_L2_PR_GCOV_005_172_A_008_2005_DHDH_A_20251122T024618_20251122T024652_X05009_N_F_J_001/NISAR_L2_PR_GCOV_005_172_A_008_2005_DHDH_A_20251122T024618_20251122T024652_X05009_N_F_J_001.h5', 'https://nisar.asf.earthdatacloud.nasa.gov/NISAR/NISAR_L2_GCOV_BETA_V1/NISAR_L2_PR_GCOV_006_064_D_082_2005_DHDH_A_20251126T154051_20251126T154125_X05009_N_F_J_001/NISAR_L2_PR_GCOV_006_064_D_082_2005_DHDH_A_20251126T154051_20251126T154125_X05009_N_F_J_001.h5', 'https://nisar.asf.earthdatacloud.nasa.gov/NISAR/NISAR_L2_GCOV_BETA_V1/NISAR_L2_PR_GCOV_006_165_D_082_2005_SHSH_A_20251203T154910_20251203T154945_X05009_N_F_J_001/NISAR_L2_PR_GCOV_006_165_D_082_2005_SHSH_A_20251203T154910_20251203T154945_X05009_N_F_J_001.h5', 'https://nisar.asf.earthdatacloud.nasa.gov/NISAR/NISAR_L2_GCOV_BETA_V1/NISAR_L2_PR_GCOV_006_172_A_008_2005_DHDH_A_20251204T024618_20251204T024653_X05007_N_F_J_001/NISAR_L2_PR_GCOV_006_172_A_008_2005_DHDH_A_20251204T024618_20251204T024653_X05007_N_F_J_001.h5', 'https://nisar.asf.earthdatacloud.nasa.gov/NISAR/NISAR_L2_GCOV_BETA_V1/NISAR_L2_PR_GCOV_006_172_A_008_2005_DHDH_A_20251204T024618_20251204T024653_X05009_N_F_J_001/NISAR_L2_PR_GCOV_006_172_A_008_2005_DHDH_A_20251204T024618_20251204T024653_X05009_N_F_J_001.h5']

2b. Download a GCOV product

from pathlib import Path

data_dir = Path.home() / "GCOV_data"
data_dir.mkdir(exist_ok=True)
print(f'data_dir: {data_dir}')

asf.download_url(hdf5_files[0], data_dir, session=session)
data_dir: /home/jovyan/GCOV_data

3. Load an HDF5 dataset as a GenericProduct.GCOV object

from nisar.products.readers import open_product
from pathlib import Path

data_dir = Path.home() / "GCOV_data"
data_dir.mkdir(exist_ok=True)
gcov_path = list(data_dir.glob("*.h5"))[0]
gcov = open_product(gcov_path) 
gcov
<nisar.products.readers.GenericProduct.GCOV.GCOV at 0x7f1662d0d160>

4. View the GCOV metadata

The GCOV object contains member variables, methods, and additional ISCE3 objects that all hold product metadata.

4a. View the available GCOV member variables.

gcov_member_variables = {
    "CFPath": gcov.CFPath,
    "CalibrationInformationPath": gcov.CalibrationInformationPath,
    "GridPath": gcov.GridPath,
    "IdentificationPath": gcov.IdentificationPath,
    "MetadataPath": gcov.MetadataPath,
    "ProcessingInformationPath": gcov.ProcessingInformationPath,
    "ProductPath": gcov.ProductPath,
    "RootPath": gcov.RootPath,
    "SwathPath": gcov.SwathPath,
    "covarianceTerms": gcov.covarianceTerms,
    "error_channel": gcov.error_channel,
    "filename": gcov.filename,
    "frequencies": gcov.frequencies,
    "identification": gcov.identification,
    "polarizations": gcov.polarizations,
    "productType": gcov.productType,
    "productValidationType": gcov.productValidationType,
    "sarBand": gcov.sarBand,
    "sourceDataPath": gcov.sourceDataPath,
    "sourceDataProcessingInfoPath": gcov.sourceDataProcessingInfoPath,
    "sourceDataSwathsPath": gcov.sourceDataSwathsPath
}
max_len = max(len(v) for v in sorted(gcov_member_variables.keys()))
for k, v in gcov_member_variables.items():
    print(f"{k:{max_len}} {v}")
CFPath                       /
CalibrationInformationPath   /science/LSAR/GCOV/metadata/calibrationInformation
GridPath                     /science/LSAR/GCOV/grids
IdentificationPath           /science/LSAR/identification
MetadataPath                 /science/LSAR/GCOV/metadata
ProcessingInformationPath    /science/LSAR/GCOV/metadata/processingInformation
ProductPath                  /science/LSAR/GCOV
RootPath                     /science/LSAR
SwathPath                    /science/LSAR/GCOV/swaths
covarianceTerms              {'A': ['HHHH', 'HVHV'], 'B': ['HHHH', 'HVHV']}
error_channel                <journal.ext.journal.Error object at 0x7f1663f583b0>
filename                     /home/jovyan/GCOV_data/NISAR_L2_PR_GCOV_005_172_A_008_2005_DHDH_A_20251122T024618_20251122T024652_X05007_N_F_J_001.h5
frequencies                  ['A', 'B']
identification               <nisar.products.readers.Base.Identification.Identification object at 0x7f1662d0d010>
polarizations                {'A': ['HH', 'HV'], 'B': ['HH', 'HV']}
productType                  GCOV
productValidationType        GCOV
sarBand                      L
sourceDataPath               /science/LSAR/GCOV/metadata/sourceData
sourceDataProcessingInfoPath /science/LSAR/GCOV/metadata/sourceData/processingInformation
sourceDataSwathsPath         /science/LSAR/GCOV/metadata/sourceData/swaths

4b. View the GCOV get metadata methods

gcov_metadata_functions = {
    'getCenterFrequency("B")': gcov.getCenterFrequency("B"),
    'getProjectionEpsg()': gcov.getProjectionEpsg(),
    'getGeoGridCoordinateSpacing()': gcov.getGeoGridCoordinateSpacing(),
    'getProductLevel()': gcov.getProductLevel(),
    'getWavelength("B")': gcov.getWavelength("B"),
    
}
max_len = max(len(v) for v in sorted(gcov_metadata_functions.keys()))
for k, v in gcov_metadata_functions.items():
    print(f"{k:{max_len}} {v}")    
getCenterFrequency("B")       1293500000.0
getProjectionEpsg()           32637
getGeoGridCoordinateSpacing() (np.float64(20.0), np.float64(-20.0))
getProductLevel()             L2
getWavelength("B")            0.23176842520293778

4c. View the metadata contained in the GCOV.Identification object


gcov_identification_member_variables = {
    "absoluteOrbitNumber": gcov.identification.absoluteOrbitNumber,
    "boundingPolygon": gcov.identification.boundingPolygon,
    "diagnosticModeFlag": gcov.identification.diagnosticModeFlag,
    "diagnosticModeName": gcov.identification.diagnosticModeName,
    "isJointObservation": gcov.identification.isJointObservation,
    "isUrgentObservation": gcov.identification.isUrgentObservation,
    "listOfFrequencies": gcov.identification.listOfFrequencies,
    "lookDirection": gcov.identification.lookDirection,
    "missionId": gcov.identification.missionId,
    "orbitPassDirection": gcov.identification.orbitPassDirection,
    "plannedDatatake": gcov.identification.plannedDatatake,
    "plannedObservation": gcov.identification.plannedObservation,
    "productType": gcov.identification.productType,
    "zdEndTime": gcov.identification.zdEndTime,
    "zdStartTime": gcov.identification.zdStartTime
}
max_len = max(len(v) for v in sorted(gcov_identification_member_variables.keys()))
for k, v in gcov_identification_member_variables.items():
    print(f"{k:{max_len}} {v}")    
absoluteOrbitNumber 1655
boundingPolygon     POLYGON ((42.9653462865378 12.0272787738436 557.553526620037,42.9125469070651 12.2351268818557 765.81432984781,42.8683268796226 12.4449791459085 328.23782468113,42.820068404127 12.6539085687136 183.691620620926,42.7723845173458 12.8629850503278 -10.8949919533536,42.7219618086654 13.0714386219549 -10.4608297791094,42.671432807718 13.279881290204 -10.1777782605292,42.6207946546294 13.4883116214118 -9.9108200199742,42.5700437489284 13.696729619245 -9.49880601912043,42.5191825112214 13.9051359236512 -9.21189405386162,42.4682089397571 14.1135294238781 -8.98307611001568,42.2063461277281 14.052262858714 -8.65331268549247,41.9555721128008 13.9932938294166 -8.14497566407234,41.7140941231089 13.9362370503655 -5.93600196159487,41.4774932990126 13.8800728008649 283.703338623258,41.2474607446308 13.8252219493742 632.166014703817,41.0312795196157 13.7734539742824 203.33726444732,40.8188354333047 13.7223734422866 -98.9957114885591,40.6058062701055 13.6709461426538 164.009474054946,40.4015101418514 13.6214340465311 -77.8869926016723,40.1948676001948 13.57116121547 402.500450381049,40.2454912518004 13.3631583322704 661.682414769549,40.298300666764 13.1557063341878 638.744154487431,40.3534483885785 12.9488406748148 314.793059539874,40.4051008087753 12.741144261775 396.753082275401,40.45626654787 12.533348063747 520.611938196349,40.5077516466604 12.3256481455455 588.704772949734,40.5591860858379 12.1179543934381 646.028808380543,40.610689557535 11.9102949529027 678.165710448679,40.6622010672008 11.7026557459646 692.614989657226,40.7143663964081 11.4951913505394 610.846620162483,40.9171623578984 11.5439373873728 407.093842726266,41.1223666551817 11.5931010326159 368.355681846359,41.3315381952922 11.6430473945237 352.659269556657,41.5454427249834 11.6939481009952 328.619018107303,41.7585377244522 11.7444796333543 904.482179170271,41.9867588803042 11.7983997552816 556.360107421506,42.2139881020606 11.8518833533274 936.970033263061,42.455798273232 11.908574724359 702.984313417043,42.7001080729331 11.9656180213909 1025.49645917063,42.9653462865378 12.0272787738436 557.553526620037))
diagnosticModeFlag  0
diagnosticModeName  Science/DBF
isJointObservation  False
isUrgentObservation False
listOfFrequencies   ['A', 'B']
lookDirection       Left
missionId           NISAR
orbitPassDirection  Ascending
plannedDatatake     ['dtid_2025326024304']
plannedObservation  ['oid_2025326024308']
productType         GCOV
zdEndTime           2025-11-22T02:46:52.999342105
zdStartTime         2025-11-22T02:46:18.000000000

4d. Get the GCOV Orbit object

orbit = gcov.getOrbit()
orbit
<isce3.ext.isce3.core.Orbit at 0x7f1662bb2a30>

View the Orbit object member variables

orbit_member_variables = {
    "end_datetime": orbit.end_datetime,
    "end_time": orbit.end_time,
    "mid_datetime": orbit.mid_datetime,
    "mid_time": orbit.mid_time,
    "position": orbit.position,
    "reference_epoch": orbit.reference_epoch,
    "size": orbit.size,
    "spacing": orbit.spacing,
    "start_datetime": orbit.start_datetime,
    "start_time": orbit.start_time,
    "position": orbit.position,
    "velocity": orbit.velocity,
}
max_len = max(len(v) for v in sorted(orbit_member_variables.keys()))
for k, v in orbit_member_variables.items():
    print(f"{k:{max_len}} {v}")    
end_datetime    2025-11-22T02:50:32.000000000
end_time        10232.0
mid_datetime    2025-11-22T02:45:27.000000000
mid_time        9927.0
position        [[ 4.38904655e+06  5.52650260e+06 -1.03279885e+06]
 [ 4.40808924e+06  5.52444811e+06 -9.59565662e+05]
 [ 4.42664601e+06  5.52176152e+06 -8.86226669e+05]
 [ 4.44471386e+06  5.51844383e+06 -8.12789955e+05]
 [ 4.46228990e+06  5.51449607e+06 -7.39263613e+05]
 [ 4.47937124e+06  5.50991937e+06 -6.65655747e+05]
 [ 4.49595508e+06  5.50471493e+06 -5.91974473e+05]
 [ 4.51203867e+06  5.49888402e+06 -5.18227912e+05]
 [ 4.52761931e+06  5.49242797e+06 -4.44424197e+05]
 [ 4.54269437e+06  5.48534821e+06 -3.70571464e+05]
 [ 4.55726126e+06  5.47764623e+06 -2.96677857e+05]
 [ 4.57131747e+06  5.46932359e+06 -2.22751527e+05]
 [ 4.58486052e+06  5.46038191e+06 -1.48800627e+05]
 [ 4.59788803e+06  5.45082291e+06 -7.48333125e+04]
 [ 4.61039763e+06  5.44064836e+06 -8.57744397e+02]
 [ 4.62238705e+06  5.42986012e+06  7.31179167e+04]
 [ 4.63385407e+06  5.41846010e+06  1.47085509e+05]
 [ 4.64479651e+06  5.40645029e+06  2.21036873e+05]
 [ 4.65521228e+06  5.39383276e+06  2.94963847e+05]
 [ 4.66509934e+06  5.38060963e+06  3.68858274e+05]
 [ 4.67445570e+06  5.36678312e+06  4.42711999e+05]
 [ 4.68327944e+06  5.35235548e+06  5.16516872e+05]
 [ 4.69156871e+06  5.33732907e+06  5.90264747e+05]
 [ 4.69932171e+06  5.32170629e+06  6.63947484e+05]
 [ 4.70653672e+06  5.30548961e+06  7.37556950e+05]
 [ 4.71321206e+06  5.28868160e+06  8.11085020e+05]
 [ 4.71934613e+06  5.27128485e+06  8.84523576e+05]
 [ 4.72493739e+06  5.25330206e+06  9.57864512e+05]
 [ 4.72998436e+06  5.23473597e+06  1.03109973e+06]
 [ 4.73448563e+06  5.21558940e+06  1.10422114e+06]
 [ 4.73843985e+06  5.19586523e+06  1.17722068e+06]
 [ 4.74184573e+06  5.17556641e+06  1.25009028e+06]
 [ 4.74470206e+06  5.15469595e+06  1.32282190e+06]
 [ 4.74700769e+06  5.13325693e+06  1.39540751e+06]
 [ 4.74876152e+06  5.11125250e+06  1.46783909e+06]
 [ 4.74996253e+06  5.08868587e+06  1.54010864e+06]
 [ 4.75060977e+06  5.06556030e+06  1.61220818e+06]
 [ 4.75070235e+06  5.04187913e+06  1.68412976e+06]
 [ 4.75023943e+06  5.01764576e+06  1.75586542e+06]
 [ 4.74922028e+06  4.99286365e+06  1.82740726e+06]
 [ 4.74764419e+06  4.96753632e+06  1.89874736e+06]
 [ 4.74551053e+06  4.94166736e+06  1.96987785e+06]
 [ 4.74281876e+06  4.91526040e+06  2.04079088e+06]
 [ 4.73956839e+06  4.88831916e+06  2.11147862e+06]
 [ 4.73575898e+06  4.86084740e+06  2.18193325e+06]
 [ 4.73139019e+06  4.83284894e+06  2.25214701e+06]
 [ 4.72646173e+06  4.80432767e+06  2.32211214e+06]
 [ 4.72097337e+06  4.77528752e+06  2.39182092e+06]
 [ 4.71492497e+06  4.74573250e+06  2.46126565e+06]
 [ 4.70831643e+06  4.71566666e+06  2.53043866e+06]
 [ 4.70114775e+06  4.68509411e+06  2.59933231e+06]
 [ 4.69341897e+06  4.65401902e+06  2.66793901e+06]
 [ 4.68513021e+06  4.62244561e+06  2.73625118e+06]
 [ 4.67628166e+06  4.59037817e+06  2.80426128e+06]
 [ 4.66687357e+06  4.55782102e+06  2.87196179e+06]
 [ 4.65690626e+06  4.52477855e+06  2.93934526e+06]
 [ 4.64638013e+06  4.49125520e+06  3.00640424e+06]
 [ 4.63529564e+06  4.45725546e+06  3.07313134e+06]
 [ 4.62365331e+06  4.42278388e+06  3.13951918e+06]
 [ 4.61145373e+06  4.38784506e+06  3.20556045e+06]
 [ 4.59869758e+06  4.35244362e+06  3.27124785e+06]
 [ 4.58538559e+06  4.31658429e+06  3.33657414e+06]]
reference_epoch 2025-11-22T00:00:00.000000000
size            62
spacing         10.0
start_datetime  2025-11-22T02:40:22.000000000
start_time      9622.0
velocity        [[ 1928.46259115  -173.81440589  7317.74920749]
 [ 1880.02033476  -237.06927897  7328.73316386]
 [ 1831.27772843  -300.23035321  7338.90954523]
 [ 1782.24027941  -363.29021853  7348.27714189]
 [ 1732.91353987  -426.24148271  7356.8348355 ]
 [ 1683.30310614  -489.07677233  7364.58159931]
 [ 1633.41461798  -551.78873379  7371.51649839]
 [ 1583.25375789  -614.37003414  7377.63868973]
 [ 1532.82625022  -676.81336223  7382.94742246]
 [ 1482.13786055  -739.11142952  7387.4420379 ]
 [ 1431.19439479  -801.2569712   7391.12196962]
 [ 1380.00169847  -863.24274706  7393.98674353]
 [ 1328.56565598  -925.06154246  7396.03597777]
 [ 1276.89218976  -986.7061693   7397.26938277]
 [ 1224.98725954 -1048.16946683  7397.68676115]
 [ 1172.85686154 -1109.44430259  7397.28800766]
 [ 1120.50702777 -1170.52357304  7396.0731091 ]
 [ 1067.94382517 -1231.40020445  7394.04214428]
 [ 1015.17335494 -1292.06715356  7391.19528397]
 [  962.2017518  -1352.51740825  7387.53279087]
 [  909.03518325 -1412.74398835  7383.05501959]
 [  855.67984904 -1472.73994629  7377.76241667]
 [  802.1419803  -1532.49836806  7371.65552048]
 [  748.42783916 -1592.01237388  7364.73496117]
 [  694.54371797 -1651.27511908  7357.00146052]
 [  640.49593892 -1710.27979482  7348.45583191]
 [  586.29085344 -1769.01962885  7339.09898024]
 [  531.93484167 -1827.48788625  7328.93190205]
 [  477.43431194 -1885.67787023  7317.95568574]
 [  422.79570001 -1943.58292308  7306.17151179]
 [  368.02546842 -2001.19642711  7293.58065307]
 [  313.13010535 -2058.51180581  7280.18447494]
 [  258.1161238  -2115.52252496  7265.98443537]
 [  202.99006045 -2172.2220937   7250.98208482]
 [  147.75847473 -2228.60406555  7235.17906604]
 [   92.4279477  -2284.6620393   7218.5771138 ]
 [   37.00508116 -2340.38965988  7201.1780547 ]
 [  -18.50350323 -2395.7806191   7182.98380703]
 [  -74.09116511 -2450.82865653  7163.99638062]
 [ -129.75124634 -2505.52756046  7144.2178768 ]
 [ -185.47707238 -2559.8711688   7123.65048816]
 [ -241.26195352 -2613.85337017  7102.2964981 ]
 [ -297.09918615 -2667.46810477  7080.15828026]
 [ -352.98205389 -2720.70936516  7057.2382977 ]
 [ -408.90382873 -2773.57119693  7033.53910207]
 [ -464.85777185 -2826.04769915  7009.06333271]
 [ -520.83713422 -2878.1330248   6983.81371593]
 [ -576.83515724 -2929.82138114  6957.79306432]
 [ -632.84507303 -2981.10703006  6931.00427637]
 [ -688.8601051  -3031.98428845  6903.45033612]
 [ -744.87346854 -3082.44752875  6875.13431302]
 [ -800.87837082 -3132.49117948  6846.05936186]
 [ -856.86801225 -3182.10972597  6816.22872282]
 [ -912.83558696 -3231.29771116  6785.64572135]
 [ -968.77428379 -3280.04973645  6754.31376812]
 [-1024.67728736 -3328.36046261  6722.23635873]
 [-1080.53777923 -3376.22461065  6689.41707336]
 [-1136.34893891 -3423.63696271  6655.85957623]
 [-1192.10394526 -3470.59236272  6621.567615  ]
 [-1247.79597735 -3517.08571715  6586.54502007]
 [-1303.41821566 -3563.11199566  6550.79570388]
 [-1358.96384281 -3608.66623168  6514.32366011]]

View the Orbit object methods

orbit_methods = {
    "get_type": orbit.get_type(),
    "get_interp_method": orbit.get_interp_method(),
}
max_len = max(len(v) for v in sorted(orbit_methods.keys()))
for k, v in orbit_methods.items():
    print(f"{k:{max_len}} {v}")
get_type          MOE
get_interp_method OrbitInterpMethod.HERMITE

4e. Get the GCOV’s RadarGridParameters object

radar_grid_param = gcov.getSourceRadarGridParameters("B")
radar_grid_param
<isce3.ext.isce3.product.RadarGridParameters at 0x7f1662b8bb30>

View the RadarGridParameters object’s member variables

radar_grid_params = {
    "az_time_interval": radar_grid_param.az_time_interval,
    "end_range": radar_grid_param.end_range,
    "length": radar_grid_param.length,
    "lookside": radar_grid_param.lookside,
    "mid_range": radar_grid_param.mid_range,
    "prf": radar_grid_param.prf,
    "range_pixel_spacing": radar_grid_param.range_pixel_spacing,
    "ref_epoch": radar_grid_param.ref_epoch,
    "sensing_datetime()": radar_grid_param.sensing_datetime(),
    "sensing_mid": radar_grid_param.sensing_mid,
    "sensing_start": radar_grid_param.sensing_start,
    "sensing_stop": radar_grid_param.sensing_stop,
    "shape": radar_grid_param.shape,
    "size": radar_grid_param.size,
    "starting_range": radar_grid_param.starting_range,
    "wavelength": radar_grid_param.wavelength,
    "width": radar_grid_param.width,
}
max_len = max(len(v) for v in sorted(radar_grid_params.keys()))
for k, v in radar_grid_params.items():
    print(f"{k:{max_len}} {v}")    
az_time_interval    0.0006578947368421052
end_range           1047324.952023
length              53200
lookside            LookSide.Left
mid_range           965044.4136544167
prf                 1520.0
range_pixel_spacing 24.982704833333333
ref_epoch           2025-11-22T00:00:00.000000000
sensing_datetime()  2025-11-22T02:46:18.000000000
sensing_mid         9995.499671052632
sensing_start       9978.0
sensing_stop        10012.999342105262
shape               (53200, 6588)
size                350481600
starting_range      882763.8752858334
wavelength          0.23176842520293778
width               6588

4f. Get the GCOV’s GeoGridParameters object

geo_grid_param = gcov.getGeoGridParameters("B", "HHHH")
geo_grid_param
<isce3.ext.isce3.product.GeoGridParameters at 0x7f1662bb1c70>

View the GeoGridParameters object’s member variables

geo_grid_params = {
    "end_y": geo_grid_param.end_y,
    "end_x": geo_grid_param.end_x,
    "epsg":geo_grid_param.epsg,
    "length": geo_grid_param.length,
    "spacing_x": geo_grid_param.spacing_x,
    "spacing_y": geo_grid_param.spacing_y,
    "start_x": geo_grid_param.start_x,
    "start_y": geo_grid_param.start_y,
    "width": geo_grid_param.width
}
max_len = max(len(v) for v in sorted(geo_grid_params.keys()))
for k, v in geo_grid_params.items():
    print(f"{k:{max_len}} {v}")   
end_y     1254240.0
end_x     945360.0
epsg      32637
length    4176
spacing_x 80.0
spacing_y -80.0
start_x   604080.0
start_y   1588320.0
width     4266

5. Load a backscatter or covariance image dataset

hh_backscatter_power = gcov.getImageDataset(frequency='B', polarization='HHHH')
hh_backscatter_power
<HDF5 dataset "HHHH": shape (4176, 4266), type "<f4">

6. Subset the data by index

hh_subset = hh_backscatter_power[2000:2500, 2000:2500]
print(f"hh_subset.shape: {hh_subset.shape}")
hh_subset
hh_subset.shape: (500, 500)
array([[0.00939524, 0.00927985, 0.00995409, ..., 0.14159203, 0.20648956, 0.15859222], [0.00784624, 0.00982141, 0.00932574, ..., 0.16281128, 0.27650452, 0.23508835], [0.00944102, 0.00740898, 0.01048076, ..., 0.2080822 , 0.18525505, 0.0991888 ], ..., [0.18820381, 0.20445824, 0.23353004, ..., 0.21840286, 0.23962021, 0.21183014], [0.21182442, 0.20775032, 0.21692657, ..., 0.18688774, 0.2677307 , 0.30571747], [0.19470596, 0.26195145, 0.20456696, ..., 0.20847893, 0.22146416, 0.30142975]], shape=(500, 500), dtype=float32)

7. Reproject the data

There are multiple ways to reproject the data. GCOV objects do not have a reprogection method, so you will need to use other tools. This example uses xarray and rioxarray.

import xarray as xr
import rioxarray

# Load the image layer in an xarray.DataArray
da = xr.DataArray(
    hh_backscatter_power[...],
    dims=("y", "x"),
    name="HHHH",
)

# Add spatial coords to the DataArray
x_coords, y_coords = gcov.getGeoGridCoordinateDatasets("B")
da = da.assign_coords(y=("y", y_coords), x=("x", x_coords))

# Add the current CRS to the DataArray
epsg = gcov.getProjectionEpsg()
da = da.rio.write_crs(f"EPSG:{epsg}", inplace=True)

# Set the y and x coords as spatial dimensions
da = da.rio.set_spatial_dims(x_dim="x", y_dim="y", inplace=True)

# reproject the data
da_reproj = da.rio.reproject("EPSG:4326", inplace=True)
hh_reproj_subset = da_reproj[2000:2500, 2000:2500]
hh_reproj_subset
Loading...
hh_reproj_subset.spatial_ref.attrs
{'crs_wkt': 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]', 'semi_major_axis': 6378137.0, 'semi_minor_axis': 6356752.314245179, 'inverse_flattening': 298.257223563, 'reference_ellipsoid_name': 'WGS 84', 'longitude_of_prime_meridian': 0.0, 'prime_meridian_name': 'Greenwich', 'geographic_crs_name': 'WGS 84', 'horizontal_datum_name': 'World Geodetic System 1984', 'grid_mapping_name': 'latitude_longitude', 'spatial_ref': 'GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]', 'GeoTransform': '39.953814823307276 0.0007296740866608493 0.0 14.36507558525398 0.0 -0.0007296740866608493'}

7. Calculate statistics and transformations on the data

As a loaded HDF5 dataset, you can call many numpy functions directly on the data.

import numpy as np

print(f"min: {np.nanmin(hh_backscatter_power)}")
print(f"max: {np.nanmax(hh_backscatter_power)}")
print(f"mean: {np.nanmean(hh_backscatter_power)}")
min: 6.742128150260054e-17
max: 127.455078125
mean: 0.12399619817733765

Note that some numpy functions and attributes are not available with the loaded HDF5 dataset

For example, the code cell below will raise an AttributeError when trying to view the T (transpose attribute)

hh_backscatter_power.T
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[19], line 1
----> 1 hh_backscatter_power.T

AttributeError: 'Dataset' object has no attribute 'T'

To view the T attribute, you must first read the data into memory as a numpy.ndarray

You can trigger the data to be read into memory by indexing the entire dataset with [...]:

hh_backscatter_power.T -> hh_backscatter_power[...].T

print(f"hh_backscatter_power.shape: {hh_backscatter_power.shape}")
print(f"hh_backscatter_power[...].T.shape: {hh_backscatter_power[...].T.shape}\n")

hh_backscatter_power[...].T
hh_backscatter_power.shape: (4176, 4266)
hh_backscatter_power[...].T.shape: (4266, 4176)

array([[nan, nan, nan, ..., nan, nan, nan], [nan, nan, nan, ..., nan, nan, nan], [nan, nan, nan, ..., nan, nan, nan], ..., [nan, nan, nan, ..., nan, nan, nan], [nan, nan, nan, ..., nan, nan, nan], [nan, nan, nan, ..., nan, nan, nan]], shape=(4266, 4176), dtype=float32)

8. Plot the data

Convert the data from linear scale (power) to logarithmic scale (dB) for visualization

hh_backscatter_dB = 10 * np.log10(hh_backscatter_power)

Plot the image data in dB

import matplotlib.pyplot as plt

plt.figure(figsize=(10, 10))
plt.imshow(hh_backscatter_dB, cmap="gray", vmin=-30.0, vmax=10.0)
plt.colorbar(label="HH Backscatter (dB)")
plt.title("HH Backscatter (dB)")
plt.show()
<Figure size 1000x1000 with 2 Axes>

4. Summary

You have now run an example that loads NISAR GCOV data with isce3, accesses its metadata, creates a subset, reprojects the data, and plots an image layer.


6. Resources and references

Author: Alex Lewandowski