Giter Club home page Giter Club logo

Comments (9)

mlammens avatar mlammens commented on August 17, 2024

Hi @kellyecoles - are you sure the coordinates are in decimal degrees? That's a common problem that crops up. Also, if all the points are within 0.2 km of each other, then you might also get this error.

from spthin.

RuthPalsson avatar RuthPalsson commented on August 17, 2024

HI @kellyecoles and @mlammens - I have had exactly this problem tonight. I successfully used that code yesterday and tonight I am getting the above error. I have two data sets for two different projects. Yesterdays data set would not work tonight even though it worked yesterday. My coordinates are in decimal degrees.
I ended up getting into QGIS and thinning by hand. Tedious but the job is done.

I would still love to solve this problem.

from spthin.

mlammens avatar mlammens commented on August 17, 2024

That's pretty strange @RuthPalsson . I don't suppose you could share the points, or a subset of them, so I can trouble shoot the problem?

from spthin.

RuthPalsson avatar RuthPalsson commented on August 17, 2024

Thanks for your reply @mlammens
My data. This set worked a few days ago and now will not. I get this error message:
Beginning Spatial Thinning.
Script Started at: Wed Mar 08 08:15:48 2023Error in .subset2(x, i, exact = exact) :
attempt to select less than one element in get1index

geton_quee_AVH.csv

My code:
thin(
loc.data = input,
lat.col = "latitude", long.col = "longitude",
spec.col = "species",
thin.par = 1, reps = 10,
locs.thinned.list.return = TRUE,
write.files = TRUE,
max.files = 10,
out.dir = "outputs/", out.base = "Cineatrip",
write.log.file = TRUE,
log.file = "Cineatrip.txt"
)

from spthin.

RuthPalsson avatar RuthPalsson commented on August 17, 2024

@mlammens, this is working perfectly this morning!! Who knows what was going on!!

from spthin.

mlammens avatar mlammens commented on August 17, 2024

Odd. Usually I've seen that error when the points are too close to each other (relative to the thin distance), but that does not appear to be the case here. It is a random algorithm, so I suppose it's not totally impossible for it to work sometimes but not others. I'll have to tweak this going forward.

from spthin.

RuthPalsson avatar RuthPalsson commented on August 17, 2024

@mlammens, the data I sent you had worked initially but then didn't. I had two other sets of data that I knew had locs closer than 0.2 km - I had thinned them manually in QGIS and then yesterday, I got spThin to thin both of them to <1 km apart.
Is it in the dodumentation that points need to be >0.2 km apart? I did not notice it.
Thanks for your help.

from spthin.

riyapakhre avatar riyapakhre commented on August 17, 2024

Hii, I am trying to work with a certain species for spatial thinning and am stuck with the same error. My CSV file has a species column, lat and long columns with values in decimal.

head(hyp)
Species Latitude Longitude X X.1
1 M. (L.) Kuntze -6.563056 147.0306 NA NA
2 M. (L.) Kuntze -7.058333 146.6750 NA NA
3 M. (L.) Kuntze -9.391667 147.3083 NA NA
4 M. (L.) Kuntze -6.758333 147.0083 NA NA
5 M. (L.) Kuntze -5.250000 145.7500 NA NA
6 M. (L.) Kuntze -5.750000 145.1667 NA NA

thin(

  • loc.data <- subset_hyp,
  • lat.col = "LATITUDE",
  • long.col = "LONGITUDE",
  • spec.col = "SPECIES",
  • thin.par = 1,
  • rep = 100,
  • locs.thinned.list.return = FALSE,
  • write.files = TRUE,
  • max.files = 1,
  • out.dir = ("~/dissertation/Lifeform article'24"),
  • out.base = "thinned data",
  • write.log.file = TRUE,
  • log.file = "spatial_thin_hyp.csv",
  • verbose = TRUE
  • )

Beginning Spatial Thinning.
Script Started at: Wed Jan 31 16:42:09 2024Error in .subset2(x, i, exact = exact) :
attempt to select less than one element in get1index

Would be of great help if anyone could help me out on this. Thanks in advance!

from spthin.

mlammens avatar mlammens commented on August 17, 2024

@riyapakhre , I think this error might be from the labels your using for the Latitude / Longitude columns in the data set being different from the names you are using in the thin function -- i.e., "LATITUDE" and "LONGITUDE". Case matters in R.

from spthin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.