Package: pysolid
PySolidThe Python based solid Earth tides (PySolid) is a thin Python wrapper of thesolid.forprogram (by Dennis Milbert based ondehanttideinelMJD.ffrom V. Dehant, S. Mathews, J. Gipson and C. Bruyninx) to calculatesolid Earth tidesin east, north and up directions (section 7.1.1 in the2010 IERS Conventions). Solid Earth tides introduce large offsets in SAR observations and long spatial wavelength ramps in InSAR observations, as shown in the Sentinel-1 data with regular acquisitions and large swaths (Yunjun et al., 2022).This is research code provided to you "as is" with NO WARRANTIES OF CORRECTNESS. Use at your own risk.1. InstallPySolid is available on theconda-forgechannel and the main archive of theDebianGNU/Linux OS. The released version can be install viacondaas:# run "conda update pysolid" to update the installed versioncondainstall-cconda-forgepysolidor viaapt(or other package managers) forDebian-derivative OSusers, includingUbuntu, as:aptinstallpython3-pysolidOr build from source:PySolid relies on a few Python modules as described inrequirements.txtandNumPy's f2pyto build the Fortran source code. You could usecondato install all the dependencies, including the Fortran compiler, or use your own installed Fortran compiler andpipto install the rest.a. Download source code# run "cd PySolid; git pull" to update to the latest development versiongitclonehttps://github.com/insarlab/PySolid.gitb. Install dependencies# option 1: use conda to install dependencies into an existing, activated environmentcondainstall-cconda-forgefortran-compiler--filePySolid/requirements.txt--filePySolid/tests/requirements.txt# option 2: use conda to install dependencies into a new environment, e.g. named "pysolid"condacreate--namepysolidfortran-compiler--filePySolid/requirements.txt--filePySolid/tests/requirements.txt
condaactivatepysolid# option 3: have a Fortran compiler already installed and use pip to install the rest dependenciespython-mpipinstall-rPySolid/requirements.txt-rPySolid/tests/requirements.txtc. Install PySolid# option 1: use pip to install pysolid into the current environmentpython-mpipinstallPySolid# option 2: use pip to install pysolid in develop mode (editable) into the current environment# setting an environmental variable as below is required for editable installs via pyproject.tomlexportSETUPTOOLS_ENABLE_FEATURES="legacy-editable"python-mpipinstall-ePySolid# option 3: manually compile the Fortran code and setup environment variablecdPySolid/src/pysolid
f2py-c-msolidsolid.forexportPYTHONPATH=${PYTHONPATH}:~/tools/PySolidd. Test the installationTo test the installation, run the following:python-c"import pysolid; print(pysolid.__version__)"pythonPySolid/tests/grid.py
pythonPySolid/tests/point.py2. UsagePySolid could compute solid Earth tides in two modes:pointandgrid. Both modes produce displacement in east, north and up directions.Point mode:compute 1D tides time-series at a specific point for a given time periodGrid mode:compute 2D tides grid at a specific time for a given spatial grid2.1 Point Mode [notebook]importdatetimeasdtimportpysolid# prepare inputslat,lon=34.0,-118.0# point of interest in degree, Los Angles, CAstep_sec=60*5# sample spacing in time domain in secondsdt0=dt.datetime(2020,1,1,4,0,0)# start date and timedt1=dt.datetime(2021,1,1,2,0,0)# end   date and time# compute SET via pysoliddt_out,tide_e,tide_n,tide_u=pysolid.calc_solid_earth_tides_point(lat,lon,dt0,dt1,step_sec=step_sec,display=False,verbose=False,)# plot the power spectral density of SET up componentpysolid.plot_power_spectral_density4tides(tide_u,sample_spacing=step_sec)2.2 Grid Mode [notebook]importdatetimeasdtimportnumpyasnpimportpysolid# prepare inputsdt_obj=dt.datetime(2020,12,25,14,7,44)meta={'LENGTH':500,# number of rows'WIDTH':450,# number of columns'X_FIRST':-126,# min longitude in degree (upper left corner of the upper left pixel)'Y_FIRST':43,# max laitude   in degree (upper left corner of the upper left pixel)'X_STEP':0.000925926*30,# output resolution in degree'Y_STEP':-0.000925926*30,# output resolution in degree}# compute SET via pysolidtide_e,tide_n,tide_u=pysolid.calc_solid_earth_tides_grid(dt_obj,meta,display=False,verbose=True,)# project SET from ENU to satellite line-of-sight (LOS) direction with positive for motion towards the satellite# inc_angle : incidence angle of the LOS vector (from ground to radar platform) measured from vertical.# az_angle  : azimuth   angle of the LOS vector (from ground to radar platform) measured from the north, with anti-clockwirse as positive.inc_angle=np.deg2rad(34)# radian, typical value for Sentinel-1az_angle=np.deg2rad(-102)# radian, typical value for Sentinel-1 descending tracktide_los=(tide_e*np.sin(inc_angle)*np.sin(az_angle)*-1+tide_n*np.sin(inc_angle)*np.cos(az_angle)+tide_u*np.cos(inc_angle))3. Citing this workYunjun, Z., Fattahi, H., Pi, X., Rosen, P., Simons, M., Agram, P., & Aoki, Y. (2022). Range Geolocation Accuracy of C-/L-band SAR and its Implications for Operational Stack Coregistration.IEEE Trans. Geosci. Remote Sens., 60, 5227219. [doi|arxiv|data|notebook]Milbert, D. (2018), "solid: Solid Earth Tide", [Online]. Available:http://geodesyworld.github.io/SOFTS/solid.htm. Accessd on: 2020-09-06.