# Google Earth engine grid algebra and band calculation for NDVI

Time：2022-5-20

first, according to part II GeeTeaching bloghttps://blog.csdn.net/zhebushibiaoshifu/article/details/117296956）In the content, we willLandsat 8 Collection 1 Tier 1Atmospheric apparent reflectanceTOA ReflectanceImport the product into Gee and rename it. Next, also according to the second GeeTeaching bloghttps://blog.csdn.net/zhebushibiaoshifu/article/details/117296956）Content in, willLandsat 8 Collection 1 Tier 1Atmospheric apparent reflectanceTOA ReflectanceThe product is selected according to the time (you can choose the specific time range arbitrarily), and the average value within the corresponding time range is obtained; At the same time, the layer after the above operation will be displayed in the map.

var landsat_202006=landsat_8.filterDate('2020-06-01','2020-06-30').mean();

next, let’s start grid computing. In part 5 GeeTeaching bloghttps://blog.csdn.net/zhebushibiaoshifu/article/details/118909637）In, we usenormalizedDifference()Function calculationNDVILayer; In this paper, we try to calculate the band manuallyNDVILayer, the specific code is as follows. Among them,.select()Indicates that the corresponding band is selected from the remote sensing image,.subtract()The function represents the subtraction operation between bands; Similarly,.add()The function represents the addition operation,.divide()Indicates a division operation.

var band_4=landsat_202006.select('B4');
var band_5=landsat_202006.select('B5');
var numerator=band_5.subtract(band_4);
var NDVI=numerator.divide(denominator);

run the above code and you can seeNDVIThe layer has been generated.

here’s another point to note: in the most primitiveLandsat 8 Collection 1 Tier 1Atmospheric apparent reflectanceTOA ReflectanceProduct (data type:ee.ImageCollection）After selecting according to the time and obtaining the average value within the corresponding time range (the data type isee.Image）, each band of remote sensing image can participate in the calculation. in other words,.subtract()These band operation functions are only foree.ImageValid data; And ifee.ImageCollectionAnd other data types need to participate in band calculation, as well as mapping and other operations.

in addition, we can also follow Part IV geeTeaching bloghttps://blog.csdn.net/zhebushibiaoshifu/article/details/117573181）Medium method, rightNDVIThe layer is manually visualized and configured, and the configuration is embedded into the code, so as to realize the result of each code runNDVIThe layer visualization settings are consistent.

The specific codes are as follows:

you can see it after runningNDVIThe layer already has the default visualization configuration~

## Add fillets to the cells of each section in IOS tableview

tableViewNeed to implement a page similar to wechat me,tableViewOf each sectioncell, the first part is rounded, the middle part is not, and the last one is rounded. The specific effects are as follows: Add fillet to the cell of each section png Maybe you’ll think cell.layer.cornerRadius = 8; cell.layer.masksToBounds = YES; be careful ⚠️：iOS14systemcellFillet cannot […]