Questions tagged [loop]

A sequence of instructions that repeats either a specified number of times or until a particular condition is met.

Filter by
Sorted by
Tagged with
-6
votes
0answers
25 views

HOW CAN I WRITE THE OUTDATA TO EXCEL SHEET IN PYTHON [closed]

HOW CAN I DUMP THE FOR LOOP VARIABLE DATA TO EXCEL SHEET IN PYTHON,IF THE OBJECT IS IN NUMPY.FLOAT32 FORMAT.
0
votes
0answers
20 views

Create a loop to run and store the r.stats output of several viewsheds?

I have 15 viewsheds (view 0-14) from which I would like to export the cell count. I can do this for one viewshed through: count=[] i=0 viewshedSize=grass.read_command("r.stats", overwrite=True,flags=...
0
votes
0answers
21 views

Summarizing Continental Biome Data in R

I have written code the produces a mean threshold value for the amount of satellite imagery needed in a single year to produce the 95th percentile of NDVI. I assume that this threshold of satellite ...
1
vote
1answer
31 views

Loop to intersect points with polygons in R for each individual

I have a shapefile with points for 6 individuals and another shapefile with 6 polygons (one per individual). Every individual has the same id in both files. I want to intersect both layers in order ...
0
votes
1answer
18 views

Writing a for loop in r to process multiple rasters with quantiles values

I am trying to get R to read a folder containing raster files, and then in a foor loop, extract quantile values from each of the raster to enventually process each raster with a substraction involving ...
1
vote
1answer
28 views

Using ArcPy with Intersect and loop

I am new to scripting. I have around 4500 small shapefiles to be intersected with one big shapefile. The primary key is to make 4500 small intersected shapefiles. How to do it correctly by using ...
0
votes
1answer
21 views

Function to calculate time series wise max and min

I have image collection from that I want to make a loop function where I want to call all images that have the same temporal resolution but date range varies (like 2000-06-09 to 2019-06-17) through ...
1
vote
1answer
97 views

How do I create several concentric buffers in a loop in R

I am working with polygons and I need to create concentric buffers every ten kilometers until I reach a distance of 70 kilometers, in this sense I want only the 10 kilometers rings without the polygon ...
2
votes
1answer
400 views

How to mask NetCDF time series data from a shapefile in Python?

I have a 3-D time-series precipitation data (187 x 1800 x 3600), stored in a NetCDF file. I need to obtain the precipitation data for a shapefile. import matplotlib.pyplot as plt from netCDF4 ...
1
vote
0answers
14 views

Loop on table to create Dynamic Layers

I am receiving a table with customer names, group of customers and some data. I need to create dynamically Layers of these groups, then add these customer to these respective groups, then display a ...
1
vote
2answers
55 views

Difficulty with select by attributes using list fields in for loop

I am trying to add fields to a table and then populate the fields with text values (Yes/No). The text values are based on whether or not a species was found in a specific block. If the species was ...
1
vote
1answer
28 views

Loops for calculating vegetation indices for multiple temporal images and each image have multiple bands

I have 64 TIFF files of different dates, each date has 4 bands (123 and 4 for B, G R and NIR). I am trying to develop a Vegetation index for each date image. This is how the images in my folder are [...
2
votes
0answers
92 views

Clipping Raster by Mask using PyQGIS

I'm trying to develop code that is capable of cutting out a mosaic from the polygons of a shapefile using PyQGIS. The script is run but does not produce any results. from qgis.core import * from ...
2
votes
1answer
37 views

Iterate through path type inside 'WHERE' statement

I have a table defined as following CREATE TABLE public.geometry_polyline_volume ( id serial not null primary key, distance float not null, height float not null, ...
4
votes
2answers
134 views

Different Results in GEE when using manually upload polygon and uploaded shapefile

I have a code that classifies polygons based on their NDVI values (based on mean and std, classes into 3 ranges: high, medium and low). The code suppose to do this process for each polygon, but I ...
1
vote
1answer
58 views

Calculate field with a value in a list based on field [closed]

I don't want to write an if statement for every field. I want to know if there is another way to field calculate each field with the values related to it in this example table: Fields (X,Y,...
2
votes
2answers
34 views

Is there any way to force a loop to go until the last list object in R?

I am running a loop in R to rasterize a list of data frames and for comparison purposes I have to keep the same list length in the output. I am facing some problems with NULL objects on the list. I ...
3
votes
1answer
97 views

Loop checking if attribute field exists in PyQGIS

I'm building my first script and I need help to create a loop instead of my repetitiv functions. The aim is to check if every field already exists, and to build it only if it doesn't. This script ...
-1
votes
1answer
33 views

ArcPy: Delete field loop with if exception

Am new to ArcPy , am trying to join the same features from different geodatabase but I don't need all of attributes, so want to make a loop to find each feature class and delete the fields I don't ...
4
votes
1answer
68 views

How can I process vector difference between 1 group layer and 1 polygon layer?

I have one layer group called 'left_buffer', containing 40 buffered polygon layers (name: 1,2,3,...,39,40). I want to use difference vector tool between 'left_buffer' and 'bldg' layer, but I'm getting ...
4
votes
1answer
56 views

Export looped layers at once using PyQGIS?

I am trying to use one-side buffer on road centerline (layer name: small_road) by 1~40m. I've succeeded in creating one buffer (2m) file at a time using 'SEGMENTS':2,'JOIN_STYLE':0,'MITER_LIMIT':2,'...
1
vote
1answer
82 views

Count the number of pixels according to their value using for loop

I have script that does the enxt procedures: create imagecollection from Landsat7 clip the images according to specific geometry and calculte NDVI for each one filter the rasters according to the ...
1
vote
0answers
14 views

Copying Features from multiple sources

I'm new to Python and trying to automate copying specified features from a bunch of nested geodatabases into a new geodatabase- script seems to work ok, except for the copying features part (the 2 ...
3
votes
1answer
63 views

Map algebra with loop and SetNull not working

I'm trying to run a loop through a number of rasters while using SetNull but keep receiving an error message. I have worked on these rasters individually using SetNull and it it works, but would need ...
0
votes
1answer
41 views

Use GDAL to resample and stack multidate image spectral bands

I have a Sentinel 2 multidate image data set and I'm trying to resample all of them at 10m and then stack them to apply a cloud mask, in Python language. Being new to programming, I have a hard time ...
1
vote
1answer
115 views

Iterate through raster in R and apply conditional statements

I have a raster data set in R with numeric values ranging from 0 to 61.5, including some random NAs throughout. I would provide a reproducible data set, but I don't know how to create a raster with ...
1
vote
2answers
53 views

Select_analysis Looping gives ERROR 000732

The script I use for select_analysis is no longer working. I believe part of the problem is the source data I use (and I'm not the administrator of) has changed the field properties of the attribute I ...
0
votes
1answer
34 views

Iterating through geodatabase and assigning field value based on spatial location using ArcPy - Part 2

This currently loops through my dataset and calculates the installation ID field from my dataset with the installation code from my Bragg Area feature that are within the polygon of each row. It works ...
2
votes
0answers
22 views

Iterator (Iterate Feature Selection) running loop in undesired path using ArcMap ModelBuilder?

I am building a model using Iterate Feature Selection. I want to run the Iterator -> select by location -> Calculate field, and after finishing this loop (#3 in the image below), I will continue to ...
1
vote
0answers
33 views

Loop in ModelBuilder in a specific situation

I would like to make a loop in the next model base on a expression, this expression received a code with consecutive numbers in a reference layer call "sector", to summarize, for each "code" do a "...
0
votes
1answer
66 views

Loop through geodatabases and list feature classes [closed]

Trying to find a way to use Python or SQL to loop through geodatabases and print the feature classes. I'm not sure what the difference between while and for loops are; I'm brand new to scripting. A ...
1
vote
1answer
73 views

Looping through two raster folders to perform raster calculation?

I have two geodatabases with rasters containing information about "treecover" and "loss". The file names are slightly different but can be matched based on the last 8 characters (the coordinates of ...
1
vote
1answer
228 views

Loop with predict raster function in R [closed]

My data is a dataframe of ALTITUDE in the first column, and monthly temperatures (let's say for a year) in the other columns. I used the following code to create a linear model for each monthly ...
1
vote
2answers
45 views

Use ArcPy for finding value throughout all fields and export to new layer

I need to find a way to find a specific value in the attribute table and then export all rows with said value to a new feature class. Below is the code that I have managed to come up with (using ...
2
votes
1answer
274 views

Extract time series from ImageCollection for multiple points - Google Earth Engine

I have the Sentinel 2 (COPERNICUS/S2) ImageCollection and a FeatureCollection of points. I want to extract a time series for each of the points from the band information in the ImageCollection. So ...
0
votes
1answer
37 views

Write a text file per image with same name in R

In R I would like to create a text file for each picture I have in a folder and with the same name. By example: Picture 1.png - Picture 1.txt Picture 2.png - Picture 2.txt But the text file name I ...
1
vote
1answer
134 views

Make a loop in Google Earth Engine for reduce NDVI from year a months?

I have this code, it generate N ImageCollection and for each image a chart from NDVI in function a the months This is the place of study: var areaEst = ee.FeatureCollection("users/aleszczuk/...
0
votes
0answers
73 views

Didn't show all the column while export the CSV file while using Google Earth Engine

I'm trying to calculate the water areas and the statistics of each band for each water areas to see if there are seasonal changes. The exported .csv file only have the columns ("GNIS_ID","AreaSqKm","...
0
votes
1answer
132 views

Multiple selections with a python loop

I am very new to Python and have no idea about how to write a python loop to do selections for ArcGIS. I already finished writing selection codes with different conditions. Is there anyone helping me ...
1
vote
0answers
37 views

Creating loop in raster algebra which compares each cell to values of other rasters in time series?

I have a list of rasters representing NDVI values (and plan to do similar thing with some other index values as well) and in that raster I also set all values representing clouds to NoData. Now, for ...
2
votes
1answer
94 views

Nested loop and terrain analysis R

I have a raster stack with 11 layers that I am running through a triply nested lapply(). I expect 44 layers to be returned, but I'm only seeing 4! Reproducible example: # Load packages library(...
2
votes
1answer
318 views

ReduceRegion Loop GEE [closed]

I'm trying to loop a ReduceRegion function in Google Earth Engine to obtain a month mean NDVI over a polygon. But I've not been successful yet. I did for one month. At the end, I should have a list ...
1
vote
0answers
33 views

Make a script run indefinitly

I have created a script which reads a JSON file and based on the attributes creates a grid and assigns values to the grid. This JSON file may change. I wanted to create an infinite loop to run the ...
0
votes
1answer
397 views

How do I implement a JSON file with coordinates into a var with featurecollection? (TURF)

I am trying to use the nearest function in TURF, so what I have is a JSON file with information about parkades: { "type" : "FeatureCollection", "name" : "ubcv_parking_www", "features" : [ { ...
1
vote
1answer
119 views

Buffer loop with Python QGIS

I want to iterate a buffer from a list of distances I have, but I can´t find the way to do it. I´m a beginner on Python. import processing x=[100, 200, 300, 400, 500] processing.run("native:buffer",\ ...
0
votes
2answers
56 views

Loop through a range of rasters and use tool output as input for the next tool run

I'm using the particle track tool and limiting it to a specific trackingtime. For each tool run, I want the rasters input (magnitude and direction) to change to the next rasters in the lists, and the ...
0
votes
1answer
300 views

Including conditional operation depending on number of images?

I want to do certain operations depending on the number of images in a filtered collection. I am working within a loop, so I need the condition to jump to the next step in the loop given a condition. ...
1
vote
1answer
906 views

Looping a raster stack with a step, R

I have a large raster stack of about 500 rasterlayers. What I want to do is to extract specific layers and store them in a different strack. The layers for which I am interested in, have a step of 8 ...
0
votes
1answer
46 views

Loop through two raster datasets by order and perform a function

I have two raster datasets that I need to loop through by order and select the first raster from the first dataset with the first raster from the second dataset to perform a function. I keep getting ...
0
votes
1answer
215 views

Export raster over a loop in Google Earth Engine

I would like to export raster in a foreach loop with : var landCover = ee.Image('MODIS/006/MCD12Q1/2016_01_01').select('LC_Prop1'); var countries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017'); ...

1
2 3 4 5 6