Giter Club home page Giter Club logo

Comments (6)

julianoscabral avatar julianoscabral commented on May 31, 2024

I mean, if you have code to transform an array into a raster stack, let me know

from r-package.

benj919 avatar benj919 commented on May 31, 2024

I'm not sure what your point on rds files is. You can save rasters as rds files the same way as any other object in R (mostly true, but irrelevant here where not)...and internally there is no place where the list of environments is saved directly as an rds. They all get mangled into the landscapes.rds format...

As for the dataframe to raster thing:
assume # temp <- list(of_data.frames)
library(raster)

What format are your data frames?
If they are in the form of x,y,data you can call:
temp <- lapply(temp, rasterFromXYZ)

If they are cell grids you can do this (with a detour over matrices):
temp <- lapply(temp, function(x){raster(as.matrix(x), xmn = 0.5, xmx = 31.5, ymn = 0.5, ymx = 31.5)})

?raster
_# S4 method for signature 'matrix'
_# raster(x, xmn=0, xmx=1, ymn=0, ymx=1, crs=NA, template=NULL)
_# note the _mn=0.5, _mx=31.5 boundaries, they put your cell centers at 1:31 instead of 0.5:30.5

from r-package.

julianoscabral avatar julianoscabral commented on May 31, 2024

My point is that it does not make much sense that the user who creates his/her own landscapes needs to create a list of rasters from a list of data frames (x,y,data) if the create_input() will turn the rasters to a rds file. So, the create_input() should be able to accept a list of data frames directly.

from r-package.

julianoscabral avatar julianoscabral commented on May 31, 2024

I will try to turn the array of data frames into a list of rasters to check if the function works though.

from r-package.

benj919 avatar benj919 commented on May 31, 2024

? I think you are confusing data.frames with the file extension .rds . Data.frames ( or rasters for that matter) are objects within R while .rds is just a convention for how to name the serialized storage of almost any R object. There is no close relationship between these. As such there is no advantage or requirement for a user to create his landscape as data.frames rather than rasters as is currently required...

I agree that we might want to expand the range of accepted input formats at some point, but this is not a priority right now...

from r-package.

ohagen avatar ohagen commented on May 31, 2024

This could be solved fairly easly by a internal loop in input_creation, however I am not sure how the col names will withstand the convertion data.frame to rater and back to data.frame

from r-package.

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.