Questions tagged [loop]
A sequence of instructions that repeats either a specified number of times or until a particular condition is met.
377
questions
0
votes
1
answer
19
views
Issue using while loop in Google Earth Engine
I am trying to write an iterative procedure using the GEE Code Editor. I initially calculate a variable "AR" and if this variable is greater than a specified threshold, then an iterative ...
0
votes
2
answers
72
views
Loop an operation in all features
I have a layer that has date and time information and I need the difference between this information in seconds, I managed to get close to this but I needed to loop for the difference between the ...
0
votes
0
answers
16
views
How to add attributes to a raster stack
I have a dataframe ("DataGroup"), which holds tracking data from individual birds. Each bird has a unique id ("ID"), and belongs to one of 10 study groups ("DGroup").
In ...
0
votes
1
answer
31
views
Repeat a process for several .csv files (containing points) in Google Earth Engine
I need to extract the time series of estimated NDWI from LANDSAT for three year (2020-2022) all around the word. I have to do this process over a regular grid (9-km) and I noticed that the process ...
0
votes
0
answers
27
views
Create polygons using a loop in virtual layer
I would like create singlepart polygons including polygons from layer Polygons which have the same value in their row unique_number, and fill the spaces in between.
It will result several polygons : 1 ...
3
votes
2
answers
155
views
Looping area calculations for multiple rasters in R
The following code works great on individual rasters and gives me the information that I want:
r<-rast("LuckSpring_2001.tif")
activeCat(r)<-"Class_name"
r
f <- freq(r)
f$...
0
votes
1
answer
317
views
Data extraction for time series, transform multiple netCDF files to spatRaster with terra in R
I would like to extract data from around 13,000 .nc files to create a time series of temperature global data in R. Each of my files contain a day worth of data of global SST (my variable of interest) ...
1
vote
0
answers
19
views
Error when running loop to section out data in R
I am attempting to run a loop in R that looks at home ranges of 27 individual animals by individual and by year.
I tried running this code:
df <- read_csv('animaltelemetry.csv')
df<-data.frame(...
0
votes
0
answers
24
views
Looping through points in an image to find date range with highest cumulative rainfall
New to GEE and confused about difficulty of iterating through items. I want to find the planting season, which is very location specific, and I define it as the 90 day period at a given location with ...
0
votes
1
answer
60
views
Make a loop for daily snowdepth in Google Earth Engine
This code gives me the snow depth less than 0.0254 for each day in 2021, as 0 and 1 (0 means snow depth greater than 0.0254 and 1 means snow depth less than 0.0254) but, at the end, I want an image ...
1
vote
1
answer
57
views
How to create a function or loop to import training data for several regions in GEE at once
For several supervised classifications I want to assign training data from one feature collection to several regions, for which I have a quality mosaic each.
My dataset for the feature collection ...
0
votes
1
answer
113
views
Calculating dNBR for Image Collection in GEE
I'm trying to calculate the differenced normalized burn ratio (DNBR) values for a Landsat image collection in Google Earth Engine for detect fire date and measure burned area using the following code; ...
0
votes
2
answers
107
views
Multiply two rasters in R, one raster has stack of 25 images, and another raster has one image
I want to multiply two rasters (one has 25 images, and the second raster has 1 image). I am using the loop function for multiplication. But I am not getting the results.
library(raster)
library(rgdal)
...
0
votes
1
answer
48
views
Create several imageCollections with individual names in a loop in GEE
I am trying to create imageCollections for several regions in a loop in GEE.
I am struggling with assigning them to individual variables which are available after exiting the loop. So far, after ...
0
votes
0
answers
26
views
Loop a model on input list
I built a model that takes as input - among others - a string value of a road_id. It executes various operations on different layers performing joins and many other tasks. The model is built in such a ...
0
votes
1
answer
30
views
Arcpy - loop through files in 2 folders to calculate multiple NDVI files
I am trying to calculate multiple NDVI files from multiple red band files and NIR band files in 2 separated folders with the following code using python:
import arcpy
from arcpy.sa import *
# set ...
1
vote
0
answers
117
views
Loop over an asset export task (GEE Python API)
I have a collection of shapefiles (plots of land), for each of which I'm first generating a time series of Sentinel SAR-1 images and then running a change detection algorithm over that time series. I ...
2
votes
2
answers
228
views
FME Loop: Many to many connection
I have two tables with lines.
The 1st table has an attribute end_point
The 2nd table has an attribute start_point
I want to join the first table with the second table (end_point = start_point).
It ...
3
votes
1
answer
70
views
Custom ST_MultiSplit PostgreSQL function error, to split one layer with another
I have a lines layer which I would like to split with a points layer.
I first created the a ST_MultiSplit function:
CREATE OR REPLACE FUNCTION ST_MultiSplit(geom Geometry, blades Geometry) RETURNS ...
0
votes
1
answer
68
views
ArcPy UpdateCursor - Adding different text to more than one row of a shapefile entity
I have the following code, which adds a field, and then a value to a row:
import arcpy
V1 = r"path/shapefile.shp"
# Add CODE field
arcpy.AddField_management(V1, "VERTEX", "...
4
votes
1
answer
196
views
QGIS Python loop integer with select by expression
I want to use a loop to select values with expression in a layer. The values contain the letters OS and a number (example: "OS1","OS2"). I want to use the loop to increase the ...
0
votes
1
answer
86
views
Make a Loop for daily windspeed in Google Earth Engine?
This code give me mask out pixels where in all of wind speeds are below 5, but if I want use this code for many days what should I do? It is hard to write for 30 days. Actually, I want run this code ...
0
votes
1
answer
213
views
how write loop for time series in google earth engine
I'm trying to calculate the windspeed from a pixel many times changing the date range from an image collection. I Don't know how write loop for that:
var fc = ee.FeatureCollection('USDOS/LSIB_SIMPLE/...
0
votes
2
answers
150
views
Double indexing and looping over raster lists in R
I have a list of 63 rasters. They are the same extent, resolution, projection, etc. Because I extended 62 rasters to the maximum extent of the 63rd, I introduced NA values. However, these are relative ...
0
votes
1
answer
102
views
Looping a monthly mean NDVI over a list of years
I need to calculate mean NDVI on a year-parish level in Ecuador. Parishes are the finest level of governmental structure. I have written code (heavily based on this: https://knowyourspace.dk/2020/12/...
0
votes
1
answer
123
views
Make a loop to fill null pixels of an image with other images
I am new at Google Earth Engine and I want to fill null pixels of an image collection with pixels of complete images. In my case I want to make that in a loop, in which one the first image of a list ...
1
vote
1
answer
252
views
Loop through geodataframe, append 0 values between 2001-2021
I have produced a GeoPandas geodataframe (attached) with rows containing "loss_year" between 2001 and 2021, and some area values (pictured).
I wish to append the omitted years between 2001 -...
0
votes
1
answer
98
views
trying to use a loop to buffer around multiple feature classes at once (arcgis using arcpy)
I am using ArcPy to work within a geodatabase in ArcGIS Pro. I need to create a buffer around all the feature classes of a certain type listed in a previous line of code. well_path_list lists all the ...
0
votes
1
answer
105
views
Name output feature classes with feature names with ArcPy
I would like to have my output feature classes take on the name of the input features list that I am looping through. Example output FEMA_Clip_09302022
The code below is currently creating output ...
0
votes
0
answers
228
views
Loop through headers in CSV file and make shapefiles from each header
I am unable to figure a way out how to create a shapefile after looping through the csv files and matching the headers (dates in format Oct11/2018). Each shapefile should have all the fields with the ...
0
votes
0
answers
87
views
Looping coefficient values for raster calculator
I am trying to loop through dbf files to obtain coefficient values using calculate tool and then insert in regression equation using raster calculator to make extrapolated maps. But so far I have ...
2
votes
3
answers
1k
views
How to subset a raster stack by year with a loop in R?
So I have a folder with loads of .tif files showing NDVI. What I want to do is read them into a rasterStack, then subset that stack by year. I've been able to do this manually, but I'd really like to ...
0
votes
1
answer
541
views
Creating custom rectangles for SF features
I am trying to create a custom rectangle for each point in my df. I am using two functions to loop through each feature and write a new polygon output. I would like one SF data frame with each of the ...
1
vote
0
answers
49
views
Running multiple models within a Toolbox (.tbx) with 1 python script
I am trying to run over 80 models between 2 toolboxes. I know I can list them out to run them (example #2) but is there a way to iterate/loop through each model and run them one at a time without ...
1
vote
3
answers
403
views
Create multiple rasters from single spatialpixeldataframe, by Unique id
I have a SpatialPixelDataFrame (spdf) which contains gridded values (UD) for different Unique id's (n = 21).
I would like to create an individual raster for each Unique_id, with value (UD) as the cell ...
0
votes
1
answer
68
views
Using a dynamic formula with parrallel kringing in R
I am trying to achieve parallel Kriging in R on several variables using a loop. Here is a reproducible example using data meuse and a code for parallel kriging that I found here. In the code below, ...
0
votes
1
answer
86
views
Looping to do cloud mask for several raster files in R [closed]
I have over 200 land surface temp (LST) rasters and I want to mask each LST raster using the corresponding cloud Mask raster. The working directory has two folders one for LST and one for cloud Mask. ...
1
vote
1
answer
85
views
Iterative computation over image collection and multiple indexing in GEE
I am having two image collections, sc, data(Sentinel 1 data).
I need to do an iterative type of computation where I need to use previous output for the next iteration and also multiple images using ...
0
votes
0
answers
195
views
Incorrect number of dimensions in creating multiple plots using a for loop with ggplot2
I'm trying to map out all these different "solutions" from the prioritize model using ggplot. (To preface I'm very new to R so perhaps my code/methods are extremely rudimentary and why I'm ...
1
vote
1
answer
223
views
Merging rasters from multiple days in loop using ArcPy
I'm using ArcGIS Pro 2.9.3, and I want to use the Mosaic to New Raster tool to merge groups of rasters. I have many days that each have multiple rasters within them. For example, I have
July3a.tif
...
1
vote
0
answers
75
views
joinbylocationsummary with loop on the same input layer using PyQGIS
I have adapted a script to use "qgis:joinbylocationsummary" in a loop.
I would like to adapt it so the loop adds all the .shp of the directory 'layers_I_want_to_add' to join their maximum to ...
1
vote
1
answer
60
views
Optimal workflow for automating placing points that represent clusters (between QGIS, FME, Python)
Ultimately I would like to automate the process of generating clusters from points (representing buildings and amenities within a neighbourhood), and placing points at street intersections which are ...
1
vote
0
answers
396
views
QGIS Python script crash when looping many times (memory problem?)
I'm having trouble with a part of a Python code that does many iterations (about 5000).
The problem found is that the program crashes, it returns an error (sometimes memory error, other times all QGI ...
0
votes
1
answer
202
views
Loop chapter with map
I need to create a document to show the interventions done in different neighborhoods, I´d like to do it on a loop as the maps are all the same, except with different shapefiles that are named the ...
0
votes
0
answers
80
views
Python script to turn off a checkbox in all layers in ArcGIS Desktop
I need to remove the check for all the layers on a map that has the "UT Simbology" check. I am not really sure If I could use update layer because this is an extension developed by a GIS ...
0
votes
0
answers
49
views
PyQGIS actions does not work for second half of the loop
I have a folder with 1600 subfolders. I've developed an script to merge two shapefiles from each subfolder and store the result in the same subfolder. I ran the script and it worked well. However, ...
0
votes
1
answer
561
views
ArcPy Spatial Join Loop use the output layer as the target feature
I am trying to generate a script that executes a Spatial Join between specific shapefiles.
However the only values that are added to the result feature are the first and last in the list of shapefiles ...
0
votes
0
answers
95
views
Create the loop for multiple raster convert to vector polygon using the arcpy scripting tool
This is my code which works only with the one raster image. But I need to create the tool that converts the multiple raster to vector in loop with arcpy.
import arcpy
from arcpy.sa import *
arcpy.env....
2
votes
1
answer
498
views
Raster calculation with conditions in R
I have two rasters (A,B) with the same resolution, extent and crs. Now I would like to generate a raster C with the value 1 for each cell that have a value of 30 or higher in A and B. I use a loop, ...
0
votes
0
answers
506
views
How to multiply one NetCDF file to multiple NetCDF files
I have one NetCDF file (region.nc) that I want to multiply to multiple NetCDF files such as the one in the picture using -mul from CDO.:
The output should be new NetCDF files resulting from the ...