Skip to content

Commit

Permalink
[DOCS] ipynb: remove unneeded whitespace (#778)
Browse files Browse the repository at this point in the history
Co-authored-by: Jia Yu <jiayu@apache.org>
  • Loading branch information
jbampton and jiayuasu authored Feb 28, 2023
1 parent b74c0d8 commit a89bb43
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions binder/ApacheSedonaRaster.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
}
],
"source": [
"''' RS_GetBand() will fetch a particular band from given data array which is the concatenation of all the bands'''\n",
"'''RS_GetBand() will fetch a particular band from given data array which is the concatenation of all the bands'''\n",
"\n",
"df = df.selectExpr(\"Geom\",\"RS_GetBand(data, 1,bands) as Band1\",\"RS_GetBand(data, 2,bands) as Band2\",\"RS_GetBand(data, 3,bands) as Band3\", \"RS_GetBand(data, 4,bands) as Band4\")\n",
"df.createOrReplaceTempView(\"allbands\")\n",
Expand Down Expand Up @@ -204,7 +204,7 @@
}
],
"source": [
"''' RS_NormalizedDifference can be used to calculate NDVI for a particular geotiff image since it uses same computational formula as ndvi'''\n",
"'''RS_NormalizedDifference can be used to calculate NDVI for a particular geotiff image since it uses same computational formula as ndvi'''\n",
"\n",
"NomalizedDifference = df.selectExpr(\"RS_NormalizedDifference(Band1, Band2) as normDiff\")\n",
"NomalizedDifference.show(5)"
Expand All @@ -230,7 +230,7 @@
}
],
"source": [
"''' RS_Mean() can used to calculate mean of piel values in a particular spatial band '''\n",
"'''RS_Mean() can used to calculate mean of piel values in a particular spatial band'''\n",
"meanDF = df.selectExpr(\"RS_Mean(Band1) as mean\")\n",
"meanDF.show(5)"
]
Expand Down Expand Up @@ -280,7 +280,7 @@
}
],
"source": [
"''' RS_GreaterThan() is used to mask all the values with 1 which are greater than a particular threshold'''\n",
"'''RS_GreaterThan() is used to mask all the values with 1 which are greater than a particular threshold'''\n",
"greaterthanDF = spark.sql(\"Select RS_GreaterThan(Band1,1000.0) as greaterthan from allbands\")\n",
"greaterthanDF.show()"
]
Expand All @@ -305,7 +305,7 @@
}
],
"source": [
"''' RS_GreaterThanEqual() is used to mask all the values with 1 which are greater than a particular threshold'''\n",
"'''RS_GreaterThanEqual() is used to mask all the values with 1 which are greater than a particular threshold'''\n",
"\n",
"greaterthanEqualDF = spark.sql(\"Select RS_GreaterThanEqual(Band1,360.0) as greaterthanEqual from allbands\")\n",
"greaterthanEqualDF.show()"
Expand All @@ -331,7 +331,7 @@
}
],
"source": [
"''' RS_LessThan() is used to mask all the values with 1 which are less than a particular threshold'''\n",
"'''RS_LessThan() is used to mask all the values with 1 which are less than a particular threshold'''\n",
"lessthanDF = spark.sql(\"Select RS_LessThan(Band1,1000.0) as lessthan from allbands\")\n",
"lessthanDF.show()"
]
Expand All @@ -356,7 +356,7 @@
}
],
"source": [
"''' RS_LessThanEqual() is used to mask all the values with 1 which are less than equal to a particular threshold'''\n",
"'''RS_LessThanEqual() is used to mask all the values with 1 which are less than equal to a particular threshold'''\n",
"lessthanEqualDF = spark.sql(\"Select RS_LessThanEqual(Band1,2890.0) as lessthanequal from allbands\")\n",
"lessthanEqualDF.show()"
]
Expand All @@ -381,7 +381,7 @@
}
],
"source": [
"''' RS_Add() can add two spatial bands together'''\n",
"'''RS_Add() can add two spatial bands together'''\n",
"sumDF = df.selectExpr(\"RS_Add(Band1, Band2) as sumOfBand\")\n",
"sumDF.show(5)"
]
Expand All @@ -406,7 +406,7 @@
}
],
"source": [
"''' RS_Subtract() can subtract two spatial bands together'''\n",
"'''RS_Subtract() can subtract two spatial bands together'''\n",
"subtractDF = df.selectExpr(\"RS_Subtract(Band1, Band2) as diffOfBand\")\n",
"subtractDF.show(5)"
]
Expand All @@ -431,7 +431,7 @@
}
],
"source": [
"''' RS_Multiply() can multiple two bands together'''\n",
"'''RS_Multiply() can multiple two bands together'''\n",
"multiplyDF = df.selectExpr(\"RS_Multiply(Band1, Band2) as productOfBand\")\n",
"multiplyDF.show(5)"
]
Expand All @@ -456,7 +456,7 @@
}
],
"source": [
"''' RS_Divide() can divide two bands together'''\n",
"'''RS_Divide() can divide two bands together'''\n",
"divideDF = df.selectExpr(\"RS_Divide(Band1, Band2) as divisionOfBand\")\n",
"divideDF.show(5)"
]
Expand All @@ -481,7 +481,7 @@
}
],
"source": [
"''' RS_MultiplyFactor() will multiply a factor to a spatial band'''\n",
"'''RS_MultiplyFactor() will multiply a factor to a spatial band'''\n",
"mulfacDF = df.selectExpr(\"RS_MultiplyFactor(Band2, 2) as target\")\n",
"mulfacDF.show(5)"
]
Expand All @@ -506,7 +506,7 @@
}
],
"source": [
"''' RS_BitwiseAND() will return AND between two values of Bands'''\n",
"'''RS_BitwiseAND() will return AND between two values of Bands'''\n",
"bitwiseAND = df.selectExpr(\"RS_BitwiseAND(Band1, Band2) as AND\")\n",
"bitwiseAND.show(5)"
]
Expand All @@ -531,7 +531,7 @@
}
],
"source": [
"''' RS_BitwiseOR() will return OR between two values of Bands'''\n",
"'''RS_BitwiseOR() will return OR between two values of Bands'''\n",
"bitwiseOR = df.selectExpr(\"RS_BitwiseOR(Band1, Band2) as OR\")\n",
"bitwiseOR.show(5)"
]
Expand All @@ -556,7 +556,7 @@
}
],
"source": [
"''' RS_Count() will calculate the total number of occurrence of a target value'''\n",
"'''RS_Count() will calculate the total number of occurrence of a target value'''\n",
"countDF = df.selectExpr(\"RS_Count(RS_GreaterThan(Band1,1000.0), 1.0) as count\")\n",
"countDF.show(5)"
]
Expand All @@ -581,7 +581,7 @@
}
],
"source": [
"''' RS_Modulo() will calculate the modulus of band value with respect to a given number'''\n",
"'''RS_Modulo() will calculate the modulus of band value with respect to a given number'''\n",
"moduloDF = df.selectExpr(\"RS_Modulo(Band1, 21.0) as modulo \")\n",
"moduloDF.show(5)"
]
Expand All @@ -606,7 +606,7 @@
}
],
"source": [
"''' RS_SquareRoot() will calculate calculate square root of all the band values up to two decimal places'''\n",
"'''RS_SquareRoot() will calculate calculate square root of all the band values up to two decimal places'''\n",
"rootDF = df.selectExpr(\"RS_SquareRoot(Band1) as root\")\n",
"rootDF.show(5)\n"
]
Expand All @@ -631,7 +631,7 @@
}
],
"source": [
"''' RS_LogicalDifference() will return value from band1 if value at that particular location is not equal tp band1 else it will return 0'''\n",
"'''RS_LogicalDifference() will return value from band1 if value at that particular location is not equal tp band1 else it will return 0'''\n",
"logDiff = df.selectExpr(\"RS_LogicalDifference(Band1, Band2) as loggDifference\")\n",
"logDiff.show(5)"
]
Expand All @@ -656,7 +656,7 @@
}
],
"source": [
"''' RS_LogicalOver() will iterate over two bands and return value of first band if it is not equal to 0 else it will return value from later band'''\n",
"'''RS_LogicalOver() will iterate over two bands and return value of first band if it is not equal to 0 else it will return value from later band'''\n",
"logOver = df.selectExpr(\"RS_LogicalOver(Band3, Band2) as logicalOver\")\n",
"logOver.show(5)"
]
Expand Down Expand Up @@ -693,7 +693,7 @@
}
],
"source": [
"''' Plotting images as a dataframe using geotiff Dataframe.'''\n",
"'''Plotting images as a dataframe using geotiff Dataframe.'''\n",
"\n",
"df = spark.read.format(\"geotiff\").option(\"dropInvalid\",True).option(\"readToCRS\", \"EPSG:4326\").load(DATA_DIR)\n",
"df = df.selectExpr(\"image.origin as origin\",\"ST_GeomFromWkt(image.geometry) as Geom\", \"image.height as height\", \"image.width as width\", \"image.data as data\", \"image.nBands as bands\")\n",
Expand Down Expand Up @@ -942,7 +942,7 @@
}
],
"source": [
"''' RS_Append() takes the data array containing bands, a new band to be appended, and number of total bands in the data array.\n",
"'''RS_Append() takes the data array containing bands, a new band to be appended, and number of total bands in the data array.\n",
" It appends the new band to the end of the data array and returns the appended data'''\n",
"\n",
"df = df.selectExpr(\"origin\", \"geom\", \"RS_Append(data, normalizedDifference, bands) as data_edited\", \"height\", \"width\", \"bands\").drop(\"data\")\n",
Expand Down Expand Up @@ -988,7 +988,7 @@
}
],
"source": [
"''' Sample UDF calculates sum of all the values in a band which are greater than 1000.0 '''\n",
"'''Sample UDF calculates sum of all the values in a band which are greater than 1000.0'''\n",
"\n",
"def SumOfValues(band):\n",
" total = 0.0\n",
Expand Down Expand Up @@ -1047,7 +1047,7 @@
}
],
"source": [
"''' Sample UDF to visualize a particular region of a GeoTiff image'''\n",
"'''Sample UDF to visualize a particular region of a GeoTiff image'''\n",
"\n",
"def generatemask(band, width,height):\n",
" for (i,val) in enumerate(band):\n",
Expand Down

0 comments on commit a89bb43

Please sign in to comment.