GithubHelp home page GithubHelp logo

Comments (12)

basille avatar basille commented on June 15, 2024

Thanks for this contribution too Sebastien! This one will not make it into sftraj, as it would be beyond the scope of the package. However, we want to make sure sftraj allows this. From what I understand, in your scenario, you have several individuals in the same sftraj, so you would need basically ways to extract spatio-temporal coordinates and this individual detail at the same time — which will be basic accessors from sftraj.

On a side note, you would want also a third column giving the individual identity in case there are more than two in one single objects… It would also be nice to be able to work over several trajectory objects (like one sftraj object per individual), and be sure that it can also work in 3 dimensions…

from sftrack.

jedalong avatar jedalong commented on June 15, 2024

we are working on tools that I think address this issue (or partly thereof) in the package wildlifeDI (which currently uses adehabitat ltraj objects)

from sftrack.

robitalec avatar robitalec commented on June 15, 2024

spatsoc provides two functions that could help here: group_times for grouping relocations temporally based off some temporal threshold (since relocations rarely share the exact same timestamp) and edge_dist for calculating the distance between all individuals (can be > 2) within timegroups. No support for azimuth at this time though.

from sftrack.

basille avatar basille commented on June 15, 2024

@jedalong and @robitalec, are there specific requirements for the tools offered by your respective packages? Would you rely on sftraj for the data part?

from sftrack.

jedalong avatar jedalong commented on June 15, 2024

Currently use ltraj, would migrate if it creates efficiencies. A key basic feature is the ability to include multiple individuals in a single sftraj object that can be easily subset (but I think you probably had that).

from sftrack.

basille avatar basille commented on June 15, 2024

It is indeed planned, but does not hurt to repeat it! In the proposal, we have:

Nesting is an essential part of the data model, as it allows any relevant boundaries of a trajectory, such as the individual level, the year, or a journey (movement from home to work and from work to shopping), and any nested combination of those. The package tidyr provides a function nest, which allows to nest columns inside a data frame, and will be used to easily switch from one level to another (e.g. from an individual representation to an individual-year representation).

So that would be one possibility… which still has to be defined properly (I will probably open a use case just for this).

from sftrack.

robitalec avatar robitalec commented on June 15, 2024

@basille, spatsoc works with data.table, so the geometries are expected as two columns (lat, lon) along with a datetime column. We then loop through (with data.table's by argument) the data by timegroup chunk and calculate distance between individuals. sftraj could be used for the data but I would worry about sacrifices in terms of speed, losing out on data.table's efficient grouped calculations.

I agree though, the handling of multiple individuals in one object is key.

from sftrack.

basille avatar basille commented on June 15, 2024

Thanks for these details @robitalec. Does spatsoc work with data.table for performance reasons only, or were there other reasons as well? Would you have very large datasets that you could share with us so we can test on our end?

from sftrack.

robitalec avatar robitalec commented on June 15, 2024

We used data.table because it's my personal preference when working with tabular data, it's really efficient and when paired with functions like fread, it can easily import large CSVs (and other text formats). Our relocation data is normally received and stored as CSVs so it felt like a natural tool to use. Advantages include: easily working with many individuals, simple chunking by season, subpopulation or other groups, efficient. Disadvantages: requires all data prep (datetimes, reprojected coordinates) and data cleaning/checking to be ad hoc (and in the spatsoc context - up to the user). The structure and integrated checks of a track-specific package would help here.

I definitely agree with the comments in #6 about anticipating larger (and not strictly wildlife) datasets and performance being a priority. spatsoc's core functions: group_times and group_pts are inherently point-based and would not benefit from trajectories being stored as a line, but having both storage options with conversion between seems like a good option, albeit more work!

Unfortunately I don't currently have any large datasets I can share. The example data in spatsoc shows our expected data structure, but is only ~14K rows.

from sftrack.

basille avatar basille commented on June 15, 2024

Our largest dataset here is >1M locations, but I'm sure we can find substantially larger ones. We can also fake them for test purposes…

As for data.table, thanks for this information! So we have:

  • Reading performance when importing data files → not covered by sftraj
  • Easy manipulation

I see there are efforts to make sf and data.table truly compatible, but I think this goes behind the scope of sftraj. As long as we rely properly on sf, then whatever sf can use should work for sftraj too.

from sftrack.

birderboone avatar birderboone commented on June 15, 2024

I'm re-opening some of these use-cases so theyre easier to find as people submit new ones.

from sftrack.

basille avatar basille commented on June 15, 2024

Closing this issue now that sftrack is developed and on CRAN.

from sftrack.

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.