Giter Site home page Giter Site logo

nick-gauthier / anthromes Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 1.0 22.17 MB

An R package for analyzing historical land use and population on regional to global scales.

Home Page: https://nick-gauthier.github.io/anthromes/

License: Other

R 100.00%

anthromes's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

gejielin

anthromes's Issues

function read_anthromes not provided

Hi Nick,
I am trying to run the analysis.Rmd file provided in the R research compendium (from Ellis et al. 2021 PNAS) but saw that the function read_anthromes is not defined. Basically it reads e.g. the an12_dgg_baseline.csv file as a stars object for the ease of downstream analysis. May I ask the function could still be provided, or alternatively, how would you suggest to read the an12_dgg_baseline.csv file into R so that it has the same class as the output of the anthrome_classify function?
Thank you!

Issue when hyde_read reads data in as stars proxy object?

Hi, I'm trying to read in HYDE raw data and inputs and cropping to my area of interest (across the tropics) with hyde_read and st_crop, then classifying the anthromes with anthrome_classify. However I run into the following error message
Error in dat/inputs["land_area"] : non-numeric argument to binary operator In addition: Warning message: In dplyr::mutate(., used = crops + grazing + urban, trees = pot_veg %in% : Incompatible methods ("Ops.stars_proxy", "Ops.stars") for "/"
So I tried to specify the data as a stars object with
anthromes_tropics <- anthrome_classify(st_as_stars(hyde_tropics), inputs_tropics), however I get a different error message that I'm not sure how to resolve
Error in st_crop.stars(x = x, y = y, crop = crop, epsilon = epsilon) : for cropping, the CRS of both objects have to be identical
As I have checked using st_crs that the CRS of both objects are identical.
I'm not quite sure how this can be resolved, if this is an issue with stars package and how stars proxy objects are dealt with, or if it's possible to read the hyde data as a stars object instead of stars proxy object?

If it helps, this is what I did to read the data in

> hyde <- hyde_read(dir = "../Data/Ellis2021-Anthromes")
> hyde
stars_proxy object with 6 attributes in 6 file(s):
$cropland
[1] "[...]/cropland.tif"

$grazing
[1] "[...]/grazing.tif"

$ir_rice
[1] "[...]/ir_rice.tif"

$popc
[1] "[...]/popc.tif"

$tot_irri
[1] "[...]/tot_irri.tif"

$uopp
[1] "[...]/uopp.tif"

dimension(s):
     from   to  offset      delta refsys point             values x/y
x       1 4320    -180  0.0833333 WGS 84 FALSE               NULL [x]
y       1 2160 89.9999 -0.0833333 WGS 84 FALSE               NULL [y]
time    1   75      NA         NA     NA    NA 10000BC,...,2017AD    

> inputs <- hyde_read(vars="inputs", dir="../Data/Ellis2021-Anthromes")
> inputs
stars object with 2 dimensions and 5 attributes
attribute(s), summary of first 1e+05 cells:
   land_area                                            pot_veg                              regions            iso       
 Min.   : NA     Tropical Evergreen Woodland                :     0   Africa                     :     0   Min.   : NA    
 1st Qu.: NA     Tropical Deciduous Woodland                :     0   Asia                       :     0   1st Qu.: NA    
 Median : NA     Temperate Broadleaf and Evergreen Woodland :     0   Eurasia                    :     0   Median : NA    
 Mean   :NaN     Temperate Needleleaf and Evergreen Woodland:     0   Europe                     :     0   Mean   :NaN    
 3rd Qu.: NA     Temperate Deciduous Woodland               :     0   Latin America and Caribbean:     0   3rd Qu.: NA    
 Max.   : NA     (Other)                                    :     0   (Other)                    :     0   Max.   : NA    
 NA's   :1e+05   NA's                                       :100000   NA's                       :100000   NA's   :1e+05  
   pot_vill     
 Min.   : NA    
 1st Qu.: NA    
 Median : NA    
 Mean   :NaN    
 3rd Qu.: NA    
 Max.   : NA    
 NA's   :1e+05  
dimension(s):
  from   to  offset      delta refsys point values x/y
x    1 4320    -180  0.0833333 WGS 84 FALSE   NULL [x]
y    1 2160 89.9999 -0.0833333 WGS 84 FALSE   NULL [y]

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.