### Example Output Band Calculations Source: https://doc.arcgis.com/en/arcgis-online/analyze/spectral-conversion-function.htm Demonstrates how the example conversion matrix is applied to input bands to calculate output bands for a pseudo-color image. ```plaintext Output band 1 = (0.1 * InputBand1) + (0.9 * InputBand2) +(0.0 * InputBand3) Output band 2 = (0.3 * InputBand1) + (0.0 * InputBand2) +(0.7 * InputBand3) Output band 3 = (0.1 * InputBand1) + (0.1 * InputBand2) +(0.8 * InputBand3) ``` -------------------------------- ### Metadata JSON Input Example Source: https://doc.arcgis.com/en/arcgis-online/analyze/key-metadata-function.htm Example of a JSON string structure used to define key metadata, including cloud cover and specific band properties. ```json { "CloudCover": 4, "BandProperties":[ { "BandName": "Blue", "WavelengthMin": 445, "WavelengthMax": 516 }, { "BandName": "Green", "WavelengthMin": 506, "WavelengthMax": 595 }, ] } ``` -------------------------------- ### Example: Calculate days between inspection and installation dates Source: https://doc.arcgis.com/en/arcgis-online/manage-data/calculate-fields.htm Demonstrates calculating the number of days between an inspection date and an installation date using date fields. The result is a whole number representing days. ```SQL - = 122 (days) ``` -------------------------------- ### Example: Calculate days between date literal and field Source: https://doc.arcgis.com/en/arcgis-online/manage-data/calculate-fields.htm Calculates the number of days between a fixed inspection date literal and a specific installation date field. ```SQL DATE'10/1/2015' - = 122 (days) ``` -------------------------------- ### Initialize ArcPy in a notebook Source: https://doc.arcgis.com/en/arcgis-online/reference/use-arcpy-in-your-notebook.htm Import the ArcPy library and verify the installed version. ```python import arcpy arcpy.GetInstallInfo()['Version'] ``` -------------------------------- ### Open a service by URL Source: https://doc.arcgis.com/en/arcgis-online/reference/use-url-parameters-scenes.htm Use the ?url= parameter to load a specific service directly into a scene. This example loads a building service for Portland, Oregon. ```url https://www.maps.arcgis.com/home/webscene/viewer.html?url=https://tiles.arcgis.com/tiles/P3ePLMYs2RVChkJx/arcgis/rest/services/Buildings_Portland/SceneServer ``` -------------------------------- ### Example: Calculate days between date field and literal Source: https://doc.arcgis.com/en/arcgis-online/manage-data/calculate-fields.htm Calculates the number of days between a specific inspection date field and a fixed installation date literal. ```SQL - DATE'6/1/2015' = 122 (days) ``` -------------------------------- ### Extract Substring from Start Source: https://doc.arcgis.com/en/arcgis-online/manage-data/calculate-fields.htm Returns a portion of a string starting from a specified index for a given length. The start index is 1-based. ```SQL SUBSTRING('Sailboat', 1, 4) ``` -------------------------------- ### Plot Spatially Enabled DataFrame (Quickstart) Source: https://doc.arcgis.com/en/arcgis-online/create-maps/use-python-code-snippets.htm Generates a quick plot of a spatially enabled DataFrame, showing the spatial distribution of features. ```python from arcgis.gis import GIS gis = GIS('home') # Assuming 'sdf' is your spatially enabled DataFrame sdf.plot() ``` -------------------------------- ### Install a specific version of a package using conda Source: https://doc.arcgis.com/en/arcgis-online/create-maps/specify-the-runtime-of-a-notebook.htm Specify the desired version of a package when installing it. Remember to restart the kernel after installation. ```bash !conda install --yes ==1.6 ``` -------------------------------- ### Create and set scratch geodatabase workspace Source: https://doc.arcgis.com/en/arcgis-online/create-maps/work-with-content-in-a-user-workspace.htm Use this code to create a scratch file geodatabase if it doesn't exist and set it as the scratch workspace environment. This is useful for temporary output data. ```python import arcpy if not arcpy.Exists('/arcgis/home/scratch.gdb'): arcpy.management.CreateFileGDB('/arcgis/home','scratch.gdb') arcpy.env.scratchWorkspace = '/arcgis/home/scratch.gdb' ``` ```python print(arcpy.env.scratchGDB) ``` -------------------------------- ### Install a package using conda Source: https://doc.arcgis.com/en/arcgis-online/create-maps/specify-the-runtime-of-a-notebook.htm Use this command to install a package like scrapy. You must restart the kernel after installation for the package to be available. ```bash !conda install --yes scrapy ``` -------------------------------- ### Create and set scratch folder workspace Source: https://doc.arcgis.com/en/arcgis-online/create-maps/work-with-content-in-a-user-workspace.htm Use this code to create a folder for a scratch workspace if it doesn't exist and set it as the scratch workspace environment. This is useful for temporary output data. ```python import arcpy if not arcpy.Exists('/arcgis/home/scratch'): arcpy.management.CreateFolder('/arcgis/home', 'scratch') arcpy.env.scratchWorkspace = '/arcgis/home/scratch' ``` ```python print(arcpy.env.scratchFolder) ```