Differences between revisions 37 and 38
Revision 37 as of 2021-08-05 13:54:16
Size: 6298
Editor: JohnWeirich
Comment:
Revision 38 as of 2021-09-07 12:51:14
Size: 6703
Editor: JohnWeirich
Comment:
Deletions are marked like this. Additions are marked like this.
Line 191: Line 191:
=== How to trim size ===
 * Use ArcMap to find the new lat and lon ranges
 * Remake geotiff with new lat and lon ranges
 * Measure the size of the lat range. Divide this number by the GSD from SPC to get number of pixels.
 * Divide number of pixels by lon range to get degPx
 * Update config.txt with these new values (i.e. lat and lon ranges, number of pixels across, degPx)
 * Make geotiff again

Overview

Archiving SPC-focus products. There are two major categories (global and regional) with two subdivisions (topography and backplanes -- aka other data). The regional products are derived from bigmaps.

Tools

These tools are stored in GitHub as archivingTools.

  • convertLatLon - Reads an X,Y,Z (or X,Y,Z,V) list and converts it into lat, lon, distance or lat, lon, value

  • backplanesGMT - Reads a bigmap and generates a list of latlon, radius, albedo, slope. Use paste latlon radius > tmp for GMT.

  • backplanesISIS - Reads a bigmap and generates 2D matrix for radius, albedo, slope, lat, lon

  • phasei - Reads a bigmap and image (the SUMFILE) and generates 2D matrix for incidence, emission, phase angles

  • coverage_p_low -- Reads all images and maplets. Creates a pgm that has every pixel marked for every image that it has, counter is only 1.
  • map_coverage_p_low - Counts the number of images that cover each bigmap pixel. Creates MAPNM-cov.txt and MAPNM-cov.pgm

  • bustGrid - Takes an ascii grid output and puts each entry on its own line. Needed to take grid and paste it with lat/lon to make grid


Grid to GeoTIF

var=radius.ll
new=big3
argR="-R280/287/-9/-3"
argR="-R0/360/-90/90"
argI="-I0.04"

date
echo "Blockmean"
gmt blockmean $var $argR $argI  > out

echo "sphereinterpolate"
cat out |  gmt sphinterpolate $argR $argI -Gtest.nc


echo "gdal translate"
gdal_translate -of GTiff -b 1 -a_srs support/60300.prj  NETCDF:test.nc $new.tif


Global

Global ICQ resolution to bin sizes [degrees]

ICQ Q Value

Vertices

Bin Size [deg]

512

1,579,014

0.041

256

396,294

0.164

128

99,846

0.649

64

25,350

2.556

32

6,534

9.917

Topography

  • /bin/cp -f SHAPE.TXT tmp
    vi tmp
    1,%s/D/E/g
    ZZ
    convertLatLon tmp > radius.ll

Sigmas

  • convertLatLon tmp 1 > sigma.ll 
  • Use sigma.ll as the input to GMT

Number of Images

  • Run globalStat
  • Use global-cov.ll as the input to GMT
    • var=global-cov.ll
      new=tCov
      argR="-R0/360/-90/90"
      argI="-I1"

Best Resolution

  • Run globalStat
  • Use global-res as the input to GMT
    • var=global-res.ll
      new=tRes
      argR="-R0/360/-90/90"
      argI="-I1"

Slope

Albedo

  • /bin/cp -f SHAPEA.TXT tmp
    vi tmp
    1,$s/D/E/g
    ZZ
    convertLatLon tmp 1 > albedo.ll


Regional

Run backplanesGMT (which is in ORExSPCsupport) (or backplanesISIS)

Topography

  • Run backplanesGMT
    •   # Make the backplanes
        name=LEADEQ
        echo $name | ~/bin/backplanesGMT

Output:

 Version:   1.50000000    
 Input map name (only 6 char no MAPFILES and .MAP)
 BIGMAP position
     V   120.38036346435547       -510.48150634765625       -54.750602722167969     
     Ux  -2.9186813160777092E-002  0.12163921445608139      -0.99214518070220947     
     Uy  0.97239929437637329       0.23332308232784271        0.0000000000000000     
     Uz  0.23149037361145020      -0.96476125717163086      -0.12509183585643768     
     QSZ          99
 Lon   279.612366       286.917664    
 Lat  -9.55961323      -2.35706925    

We'll need the Lon and Lat range for "argR", and QSZ will give an idea of what you need for "argI".

  •   # Convert them into lon/lat/val
      paste $name-lonlat.txt $name-r.txt > tmp.ll
      var=tmp.ll
      argR="-R279.612366/286.917664/-9.55961323/-2.35706925"
      argI="-I199+n"
    
      # Run the rebinning/interpolating routines
      echo "Blockmean"
      gmt blockmean $var $argR $argI  > out
      echo "sphereinterpolate"
      cat out |  gmt sphinterpolate $argR $argI -Gtest.nc

Now you need some math to convert the Lon range number of nodes (i.e. "argI") to deg/px. (286.917664 - 279.612366) / 199 = 0.03671

  •   # Convert to geoTiff
      echo "gdal translate"
      degPx=0.0367
      gdal_translate -of ISIS3 -tr $degPx $degPx -r bilinear -b 1 -co TARGET_NAME=Tethys -co DATA_LOCATION=GEOTIFF -a_srs support/60300.prj NETCDF:test.nc $name-r-ISIS.lbl

If you don't want to make it readable by ISIS, and don't care about square pixels, you can run the following

  •      gdal_translate -of GTiff -b 1 -a_srs support/60300.prj  NETCDF:test.nc $name-r.tif

prj files can be found here

How to trim size

  • Use ArcMap to find the new lat and lon ranges

  • Remake geotiff with new lat and lon ranges
  • Measure the size of the lat range. Divide this number by the GSD from SPC to get number of pixels.
  • Divide number of pixels by lon range to get degPx
  • Update config.txt with these new values (i.e. lat and lon ranges, number of pixels across, degPx)
  • Make geotiff again

Slope

* See topography

Albedo

* See topography

Sigmas

  • Run backplanesGMT (this gets lon/lat only file)
  • Take the SIGMAS.pgm and convert it to lon/lat/val files
    •    name=LEADEQ
         std2isis from=SIGMAS.pgm to=tmp.cub
         isis2ascii from=tmp.cub to=tmp1.txt
         sed '1,2d' tmp1.txt > tmp2.txt
          ~/bin/bustGrid tmp2.txt > tmp3.txt
         paste $name-lonlat.txt tmp3.txt > sigma.ll
         var=sigma.ll
  • Continue with topography script

Number of Images

  • run map_coverage_p_low
  • Convert coverage out to lon/lat/value
    •    name=LEADEQ
         bustGrid $name-cov.txt > tmp1.txt
         paste $name-lonlat.txt tmp1.txt > imgNum.ll
         var=imgNum.ll

* Continue with topography script

Photometric Data

This includes emission angle, incidence angle and phase angle.

Run phasei (located in ORExSPCsupport)


Make Pretties

gmt begin GMT_cont
gmt set GMT_THEME cookbook
gmt grdcontour test.nc
gmt end show
#gmt grdcontour test.nc -C10 -A50

gmt begin GMT_img
gmt set GMT_THEME cookbook
#gmt makecpt -Crainbow
gmt grdimage test.nc  -JM6i -B -BWSnE
gmt colorbar -DJTC -Bxa -By+lm
gmt end show


gmt begin GMT_img
gmt makecpt -Crainbow
gmt set GMT_THEME cookbook
gmt grdimage test.nc  $argR  -JM6i -B -BWSnE
#gmt colorbar -DJTC -I0.4 -Bxa -By+lm
gmt colorbar -DJTC -Bxa -By+lm
gmt end show

Setup

Use Dropbox spcShare directory

  • cd /opt/local/spc/
    relink ~/Dropbox/spcShare/Tethys .

Then in the working directory

  • relink.sh /opt/local/spc/Tethys/support .
    relink.sh /opt/local/spc/Tethys/mapConfig .

Archiving SPC (last edited 2023-05-01 08:35:29 by JohnWeirich)