mdsumner / nectar

16 stars 1 forks source link

python sheesh #12

Open mdsumner opened 2 years ago

mdsumner commented 2 years ago
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt update
sudo apt upgrade

sudo apt install g++ libxml2-dev libcurl4-openssl-dev libproj-dev cmake autoconf libtool pkg-config make libsqlite3-dev sqlite3 libnetcdf-dev libmagick++-dev libarchive-dev  proj-bin libnode-dev libxml2-dev libcurl4-openssl-dev libproj-dev  libgeos-dev  libssl-dev libudunits2-dev libprotobuf-dev protobuf-compiler imagemagick python3-dev libhdf4-dev libhdf5-dev

git clone https://github.com/osgeo/gdal
cd gdal
mkdir build
 cd build

cmake .. ##-DCMAKE_INSTALL_PREFIX=$HOME
cmake --build . --parallel 31
sudo cmake --build . --target install 
sudo ldconfig

wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py

sudo python3 -m pip install numpy packaging pandas zarr netCDF4 rasterio bottleneck
sudo python3 -m pip install "dask[complete]"
sudo python3 -m pip install xarray geopandas sparse aiohttp requests matplotlib

## R
sudo apt install --no-install-recommends software-properties-common dirmngr
# add the signing key (by Michael Rutter) for these repos
# To verify key, run gpg --show-keys /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc 
# Fingerprint: E298A3A825C0D65DFD57CBB651716619E084DAB9
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
# add the R 4.0 repo from CRAN -- adjust 'focal' to 'groovy' or 'bionic' as needed
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
sudo apt install --no-install-recommends r-base

sudo apt install gdebi-core
wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-2022.07.1-554-amd64.deb
sudo gdebi rstudio-server-2022.07.1-554-amd64.deb

sudo apt install build-essential gfortran

Rscript -e 'remotes::install_cran("RcppEigen")'

## put makeflags and cloud.r-project.org in .Renviron 
Rscript -e 'remotes::install_cran(c("angstroms", "anglr", "backports",   "base64enc", "BiocManager", "bitops",   "caTools", "crayon", "devtools", "evaluate", "formatR", "geojsonio",   "ggforce", "ggraph", "graticule", "highr", "htmltools", "htmlwidgets",   "httpuv", "knitr", "leaflet", "magick", "mapview", "markdown",   "ncdf4", "praise", "proj4", "PROJ", "reproj", "quadmesh", "raster", "rbgm", "rgdal",   "rgeos", "rgl", "rmarkdown", "RNetCDF", "rprojroot", "rworldmap",   "sf", "sfdct", "shiny", "sourcetools", "spbabel", "spdplyr",   "spex", "tabularaster", "testthat", "tibble", "tidync", "tidyverse", "traipse", "vapour",   "xtable", "yaml", "decido", "RTriangle", "silicate", "ceramic", "crsmeta", "unjoin", "lazyraster", "geodist", "sfheaders", "mapdeck",  "trip", "traipse", "bsam", "geos", "wk", "reticulate"))'
mdsumner commented 2 years ago

minimal test


import xarray as xr 
import geopandas as gp 
import pandas as pd 
import sparse

store = 'https://ncsa.osn.xsede.org/Pangeo/pangeo-forge/gpcp-feedstock/gpcp.zarr'

ds = xr.open_dataset(store, engine='zarr', chunks={})
ds
<xarray.Dataset>
Dimensions:      (latitude: 180, nv: 2, longitude: 360, time: 9226)
Coordinates:
    lat_bounds   (latitude, nv) float32 dask.array<chunksize=(180, 2), meta=np.ndarray>
  * latitude     (latitude) float32 -90.0 -89.0 -88.0 -87.0 ... 87.0 88.0 89.0
    lon_bounds   (longitude, nv) float32 dask.array<chunksize=(360, 2), meta=np.ndarray>
  * longitude    (longitude) float32 0.0 1.0 2.0 3.0 ... 356.0 357.0 358.0 359.0
  * time         (time) datetime64[ns] 1996-10-01 1996-10-02 ... 2021-12-31
    time_bounds  (time, nv) datetime64[ns] dask.array<chunksize=(200, 2), meta=np.ndarray>
Dimensions without coordinates: nv
Data variables:
    precip       (time, latitude, longitude) float32 dask.array<chunksize=(200, 180, 360), meta=np.ndarray>
Attributes: (12/45)
    Conventions:                CF-1.6, ACDD 1.3
    Metadata_Conventions:       CF-1.6, Unidata Dataset Discovery v1.0, NOAA ...
    acknowledgment:             This project was supported in part by a grant...
    cdm_data_type:              Grid
    cdr_program:                NOAA Climate Data Record Program for satellit...
    cdr_variable:               precipitation
    ...                         ...
    standard_name_vocabulary:   CF Standard Name Table (v41, 22 February 2017)
    summary:                    Global Precipitation Climatology Project (GPC...
    time_coverage_duration:     P1D
    time_coverage_end:          1996-10-01T23:59:59Z
    time_coverage_start:        1996-10-01T00:00:00Z
    title:                      Global Precipitation Climatatology Project (G...
mdsumner commented 2 years ago

recipe with standard apt gdal

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt update
sudo apt upgrade

sudo apt install g++ libxml2-dev libcurl4-openssl-dev libproj-dev cmake autoconf libtool pkg-config make libsqlite3-dev sqlite3 libnetcdf-dev libmagick++-dev libarchive-dev  proj-bin libnode-dev libxml2-dev libcurl4-openssl-dev libproj-dev  libgeos-dev  libssl-dev libudunits2-dev libprotobuf-dev protobuf-compiler imagemagick python3-dev libhdf4-dev libhdf5-dev libgdal-dev

wget https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py

sudo python3 -m pip install numpy packaging pandas zarr netCDF4 rasterio bottleneck
sudo python3 -m pip install "dask[complete]"
sudo python3 -m pip install xarray geopandas sparse aiohttp requests matplotlib
sudo python3 -m pip install jupyter

## R
sudo apt install --no-install-recommends software-properties-common dirmngr
# add the signing key (by Michael Rutter) for these repos
# To verify key, run gpg --show-keys /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc 
# Fingerprint: E298A3A825C0D65DFD57CBB651716619E084DAB9
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
# add the R 4.0 repo from CRAN -- adjust 'focal' to 'groovy' or 'bionic' as needed
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
sudo apt install --no-install-recommends r-base

sudo apt install gdebi-core
wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-2022.07.1-554-amd64.deb
sudo gdebi rstudio-server-2022.07.1-554-amd64.deb

sudo apt install build-essential gfortran

Rscript -e 'remotes::install_cran("RcppEigen")'

## put makeflags and cloud.r-project.org in .Renviron 
Rscript -e 'remotes::install_cran(c("angstroms", "anglr", "backports",   "base64enc", "BiocManager", "bitops",   "caTools", "crayon", "devtools", "evaluate", "formatR", "geojsonio",   "ggforce", "ggraph", "graticule", "highr", "htmltools", "htmlwidgets",   "httpuv", "knitr", "leaflet", "magick", "mapview", "markdown",   "ncdf4", "praise", "proj4", "PROJ", "reproj", "quadmesh", "raster", "rbgm", "rgdal",   "rgeos", "rgl", "rmarkdown", "RNetCDF", "rprojroot", "rworldmap",   "sf", "sfdct", "shiny", "sourcetools", "spbabel", "spdplyr",   "spex", "tabularaster", "testthat", "tibble", "tidync", "tidyverse", "traipse", "vapour",   "xtable", "yaml", "decido", "RTriangle", "silicate", "ceramic", "crsmeta", "unjoin", "lazyraster", "geodist", "sfheaders", "mapdeck",  "trip", "traipse", "bsam", "geos", "wk", "reticulate"))'