Subscribe to R-sig-geo feed
This is an archive for R-sig-geo, not a forum. It is not possible to post through Nabble - you may not start a new thread nor follow up an existing thread. If you wish to post, but are not subscribed to the list through the list homepage, subscribe first (through the list homepage, not via Nabble) and post from your subscribed email address. Until 2015-06-20, subscribers could post through Nabble, but policy has been changed as too many non-subscribers misunderstood the interface.
Updated: 26 min 46 sec ago

LandGIS Open Land data service - global stack of environmental layers

Tue, 01/15/2019 - 15:55

We have recently released a webmapping system to serve global consistent
environmental and Earth science layers at spatial resolutions from 10 km
to 250 m (hopefully also soon at 100 m). This is an Open Data system as
majority of layers are distributed under the Open Data Commons Open
Database License (ODbL) and/or Creative Commons Attribution-ShareAlike
4.0 International license (CC BY-SA). Read more about LandGIS in:
http://opengeohub.org/about-landgis.

You can access the web app at:

https://landgis.opengeohub.org

The system currently (Jan 2019) serves about 300+ layers from relief and
geology, to vegetation indices, climatic images, soil properties and
classes and potential and actual vegetation. Complete overview of
available layers is available at:

https://github.com/Envirometrix/LandGISmaps

In addition to the web-mapping app, data can be accessed using the:

- Geonode installation at https://maps.opengeohub.org,
- LandGIS REST API services at https://landgisapi.opengeohub.org,
- LandGIS WCS at https://geoserver.opengeohub.org/landgisgeoserver/web/,

A copy of all layers is also available via Zenodo.org i.e. via an unique
URL.

To access data at point locations best use the REST API. For example, to
access monthly precipitations at a location X, Y you can use:

https://landgisapi.opengeohub.org/query/point?lat=7.58033&lon=35.6561&coll=layers1km&regex=clm_precipitation_imerge.(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)_m_1km_s0..0cm_.*_v0.1.tif

which returns a GeoJSON (table) with precipitation values in mm.

To access values of LandGIS layers at multiple points you can use:

curl -X POST --form "points=@test_points.geojson" --form
"layer=pnv_fapar_proba.v.jul_d_1km_s0..0cm_2014..2017_v0.1.tif"
https://landgisapi.opengeohub.org/query/points -o results.json

where test_points.geojson is the input GeoJSON file containing
coordinates of points. The multi-point access is currently limited to
max 20 points, but we hope to increase this number gradually. More
examples of how to construct spatial queries are available at:
https://landgisapi.opengeohub.org

In addition to the REST access, you can also access the LandGIS data
using the Web Coverage Service (WCS) functionality of the Geoserver e.g.
to subset layers using a bounding box. For example, to download surface
temperature for July for an area of about 300 by 300 km you can use:

https://geoserver.opengeohub.org/landgisgeoserver/ows?service=WCS&version=2.0.1&
request=GetCoverage&
coverageId=layers1km:clm_lst_mod11a2.jul.day_m_1km_s0..0cm_2000..2017_v1.0&
subset=Lat(41,45)&subset=Long(32,35)

The read limit for WCS is 4GB and response size limit is 200MB. This
means that WCS might fail if you try to fetch too large bounding boxes.
If this happens we recommend instead downloading whole GeoTIFFs from Zenodo.

We are currently preparing R functionality to allow users fetching data
from LandGIS in a more systematic way (import, overlay, subset,
plot...). If you would like to contribute to this initiative, especially
to testing the R functions, please send me an email. Also we would
appreciate if you would report any bug or inconsistency you discover
via: https://github.com/Envirometrix/LandGISmaps/issues

If you are currently producing any similar types of data (e.g.
environmental layers at resolutions from 100 m to 1 km for a global land
mask) and if you would like to publish this data on LandGIS, please
forward a proposal for publishing your global layers:
https://opengeohub.org/submitting-global-layers-inclusion-landgis and we
will get on it asap.

thank you,

Tom Hengl
https://opengeohub.org/people/tom-hengl

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Parallelization of LMZ.F3GWR.test in spgwr package

Mon, 01/14/2019 - 13:22
Thanks, I'll check it out.  Awesome!

Sincerely,
Erin


On Mon, Jan 14, 2019 at 12:21 PM Roger Bivand <[hidden email]> wrote:

> On Mon, 14 Jan 2019, Erin Hodgess wrote:
>
> > Would there actually be any interest in making GWR parallel, please?  I
> > enjoy messing with parallel stuff, but don’t want to spend time if it is
> > not productive.
>
> spgwr::gwr() takes a cl= argument to pass a parallel object into the
> function, but this only saves time if the fit.points are given as an
> argument, and where # fit points is >> # data points.
>
> Not checked for many years, used in: http://hdl.handle.net/11250/163254
> with no obvious easy advantage. Maybe worth revisiting?
>
> Roger
>
>
> >
> > Thanks for listening!
> > Sincerely,
> > Erin
> >
> > On Sat, Jan 12, 2019 at 1:56 PM Rolf Turner <[hidden email]>
> wrote:
> >
> >>
> >>
> >> On 1/13/19 1:06 AM, Roger Bivand wrote:
> >>
> >>> ... GWR is very demanding for computation. It should only ever be used
> >>> for exploring model mis-specification, never for inference or
> prediction.
> >>> So making a bad test on a bad method run faster should not be a
> priority.
> >>
> >> Fortune nomination!
> >>
> >> cheers,
> >>
> >> Rolf
> >>
> >> --
> >> Honorary Research Fellow
> >> Department of Statistics
> >> University of Auckland
> >> Phone: +64-9-373-7599 ext. 88276
> >>
> >> _______________________________________________
> >> R-sig-Geo mailing list
> >> [hidden email]
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >>
> >
>
> --
> Roger Bivand
> Department of Economics, Norwegian School of Economics,
> Helleveien 30, N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; e-mail: [hidden email]
> https://orcid.org/0000-0003-2392-6140
> https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
--
Erin Hodgess, PhD
mailto: [hidden email]

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Parallelization of LMZ.F3GWR.test in spgwr package

Mon, 01/14/2019 - 13:21
On Mon, 14 Jan 2019, Erin Hodgess wrote:

> Would there actually be any interest in making GWR parallel, please?  I
> enjoy messing with parallel stuff, but don’t want to spend time if it is
> not productive.

spgwr::gwr() takes a cl= argument to pass a parallel object into the
function, but this only saves time if the fit.points are given as an
argument, and where # fit points is >> # data points.

Not checked for many years, used in: http://hdl.handle.net/11250/163254 
with no obvious easy advantage. Maybe worth revisiting?

Roger


>
> Thanks for listening!
> Sincerely,
> Erin
>
> On Sat, Jan 12, 2019 at 1:56 PM Rolf Turner <[hidden email]> wrote:
>
>>
>>
>> On 1/13/19 1:06 AM, Roger Bivand wrote:
>>
>>> ... GWR is very demanding for computation. It should only ever be used
>>> for exploring model mis-specification, never for inference or prediction.
>>> So making a bad test on a bad method run faster should not be a priority.
>>
>> Fortune nomination!
>>
>> cheers,
>>
>> Rolf
>>
>> --
>> Honorary Research Fellow
>> Department of Statistics
>> University of Auckland
>> Phone: +64-9-373-7599 ext. 88276
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
> --
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway

Re: Parallelization of LMZ.F3GWR.test in spgwr package

Mon, 01/14/2019 - 13:05
Would there actually be any interest in making GWR parallel, please?  I
enjoy messing with parallel stuff, but don’t want to spend time if it is
not productive.

Thanks for listening!
Sincerely,
Erin

On Sat, Jan 12, 2019 at 1:56 PM Rolf Turner <[hidden email]> wrote:

>
>
> On 1/13/19 1:06 AM, Roger Bivand wrote:
>
> > ... GWR is very demanding for computation. It should only ever be used
> > for exploring model mis-specification, never for inference or prediction.
> > So making a bad test on a bad method run faster should not be a priority.
>
> Fortune nomination!
>
> cheers,
>
> Rolf
>
> --
> Honorary Research Fellow
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> --
Erin Hodgess, PhD
mailto: [hidden email]

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Comparing spatio-temporal variations across multiple years

Sun, 01/13/2019 - 03:46
Hello,
I am new to spatial statistics. I am working on a project analyzing the
spatio-temporal neonatal mortality.

I have data for six year from 2012 to 2017 specified at district level in a
shape file. The shape file consist the number of neonatal deaths and number
of live births per year for the 6 year period together with the district
names and unique district codes.

How can I compare the spatial variation of neonatal mortality rate across
the 6 years.

I have computed the neonatal mortality rate for the period and a Global
Moran's for each year.

I would want to be able to compare the spatial structure over the period to
identify any statistically significant changes in the neonatal mortality
rate.

Any assistance would be greatly appreciated. Thanks!

Sincerely,
Salami

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Parallelization of LMZ.F3GWR.test in spgwr package

Sat, 01/12/2019 - 14:55


On 1/13/19 1:06 AM, Roger Bivand wrote:

> ... GWR is very demanding for computation. It should only ever be used
> for exploring model mis-specification, never for inference or prediction.
> So making a bad test on a bad method run faster should not be a priority.

Fortune nomination!

cheers,

Rolf

--
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Parallelization of LMZ.F3GWR.test in spgwr package

Sat, 01/12/2019 - 06:06
On Thu, 10 Jan 2019, Diana Gutiérrez wrote:

> Dear all,
>
> I was wondering if it would be possible to run the F3 variability test by
> Leung et al. (2000) (as included in the spgwr package) using parallel, so
> processing times could be reduced when you have a large number of
> observations and parameters. I would appreciate any insights and/or code
> examples if you happen to know of any that can be shared.

Yes, GWR is very demanding for computation. It should only ever be used
for exploring model mis-specification, never for inference or prediction.
So making a bad test on a bad method run faster should not be a priority.

Roger

>
> Thanks in advance,
>
> Diana.
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> --
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway

Re: Harmonized Surface Reflectance Product

Thu, 01/10/2019 - 09:10
Resolved!

Il giorno mar 14 nov 2017 alle ore 15:34 Salvatore Falanga Bolognesi <
[hidden email]> ha scritto:

> I Have HLS products (for example go to see
> https://hls.gsfc.nasa.gov/data/v1.3/sites/BE/S30/2017/31UDS/
>
> HLS data are stored in Hierarchical Data Format (HDF)-4 compressed format.
> Each HDF data file is
> associated with an ENVI header file containing georeference information.
> (
> https://hls.gsfc.nasa.gov/wp-content/uploads/2017/08/HLS.v1.3.UserGuide_v2.pdf
> )
> I want to convert this data in to GeoTiff format.
> Is it possible to do that in R?
> Sincerely.
> Salvatore
>
>
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Parallelization of LMZ.F3GWR.test in spgwr package

Thu, 01/10/2019 - 08:10
Dear all,

I was wondering if it would be possible to run the F3 variability test by
Leung et al. (2000) (as included in the spgwr package) using parallel, so
processing times could be reduced when you have a large number of
observations and parameters. I would appreciate any insights and/or code
examples if you happen to know of any that can be shared.

Thanks in advance,

Diana.

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Impacts code after gstslshet

Sat, 01/05/2019 - 15:06
Hi Roger,

Thank you very much for your quick response and help. It did work.

Best,
Germán

On 1/5/19, 7:48 AM, "Roger Bivand" <[hidden email]> wrote:

    Run install.packages("sphet", repos="http://R-Forge.R-project.org") for
    Linux/OSX source install or Windows binary install of the development
    version of sphet, and please report back if this resolves the problem.
   
    Roger
   
    On Sat, 5 Jan 2019, Roger Bivand wrote:
   
    > On Fri, 4 Jan 2019, Veron M. Izon via R-sig-Geo wrote:
    >
    >>  Hi,
    >>
    >>  My name is Germán Izón. I am currently working on a project in which I am
    >>  estimating a SARAR specification using the gstslshet function. After
    >>  estimating this model I tried estimating the marginal effects using the
    >>  impacts function but I get the following error: “Error in
    >>  spdep::intImpacts(rho = rho, beta = beta, P = P, n = n, mu = mu, :
    >>  argument "evalues" is missing, with no default”. I get the same message
    >>  using the columbus data. I do not get this error after estimating a
    >>  spatial lag model (e.g., lagsarlm). I would truly appreciate any help with
    >>  this. Thank you!
    >
    > Had you provided the output of sessionInfo(), it would be easier to say. My
    > guess is that you are using sphet 1.7, and spdep 0.8-1. The use of
    > eigenvalues in impacts measures was presented by Gianfranco Piras at the
    > Spatial Econometrics meeting in June 2018, and implemented in spdep and
    > sphet, but sphet has not been released since then. I just bumped the version
    > number of sphet on R-Forge to 1.7-2, and hope that it will let you run
    > install.packages("sphet", repos="http://R-Forge.R-project.org"), which is not
    > possible at the moment (see https://r-forge.r-project.org/R/?group_id=477).
    > If you can install the development version of sphet from source, check it out
    > by:
    >
    > svn checkout svn://svn.r-forge.r-project.org/svnroot/sphet/
    >
    > and run R CMD build sphet, then R CMD INSTALL that .tar.gz file.
    >
    > Roger
    >
    >>
    >>  Germán
    >>
    >>  _______________________________________________
    >>  R-sig-Geo mailing list
    >>  [hidden email]
    >>  https://stat.ethz.ch/mailman/listinfo/r-sig-geo
    >>
    >
    >
   
    --
    Roger Bivand
    Department of Economics, Norwegian School of Economics,
    Helleveien 30, N-5045 Bergen, Norway.
    voice: +47 55 95 93 55; e-mail: [hidden email]
    https://orcid.org/0000-0003-2392-6140
    https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: Impacts code after gstslshet

Sat, 01/05/2019 - 09:48
Run install.packages("sphet", repos="http://R-Forge.R-project.org") for
Linux/OSX source install or Windows binary install of the development
version of sphet, and please report back if this resolves the problem.

Roger

On Sat, 5 Jan 2019, Roger Bivand wrote:

> On Fri, 4 Jan 2019, Veron M. Izon via R-sig-Geo wrote:
>
>>  Hi,
>>
>>  My name is Germán Izón. I am currently working on a project in which I am
>>  estimating a SARAR specification using the gstslshet function. After
>>  estimating this model I tried estimating the marginal effects using the
>>  impacts function but I get the following error: “Error in
>>  spdep::intImpacts(rho = rho, beta = beta, P = P, n = n, mu = mu, :
>>  argument "evalues" is missing, with no default”. I get the same message
>>  using the columbus data. I do not get this error after estimating a
>>  spatial lag model (e.g., lagsarlm). I would truly appreciate any help with
>>  this. Thank you!
>
> Had you provided the output of sessionInfo(), it would be easier to say. My
> guess is that you are using sphet 1.7, and spdep 0.8-1. The use of
> eigenvalues in impacts measures was presented by Gianfranco Piras at the
> Spatial Econometrics meeting in June 2018, and implemented in spdep and
> sphet, but sphet has not been released since then. I just bumped the version
> number of sphet on R-Forge to 1.7-2, and hope that it will let you run
> install.packages("sphet", repos="http://R-Forge.R-project.org"), which is not
> possible at the moment (see https://r-forge.r-project.org/R/?group_id=477).
> If you can install the development version of sphet from source, check it out
> by:
>
> svn checkout svn://svn.r-forge.r-project.org/svnroot/sphet/
>
> and run R CMD build sphet, then R CMD INSTALL that .tar.gz file.
>
> Roger
>
>>
>>  Germán
>>
>>  _______________________________________________
>>  R-sig-Geo mailing list
>>  [hidden email]
>>  https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
> --
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway

Re: Impacts code after gstslshet

Sat, 01/05/2019 - 09:19
On Fri, 4 Jan 2019, Veron M. Izon via R-sig-Geo wrote:

> Hi,
>
> My name is Germán Izón. I am currently working on a project in which I
> am estimating a SARAR specification using the gstslshet function. After
> estimating this model I tried estimating the marginal effects using the
> impacts function but I get the following error: “Error in
> spdep::intImpacts(rho = rho, beta = beta, P = P, n = n, mu = mu, :
> argument "evalues" is missing, with no default”. I get the same message
> using the columbus data. I do not get this error after estimating a
> spatial lag model (e.g., lagsarlm). I would truly appreciate any help
> with this. Thank you! Had you provided the output of sessionInfo(), it would be easier to say.
My guess is that you are using sphet 1.7, and spdep 0.8-1. The use of
eigenvalues in impacts measures was presented by Gianfranco Piras at the
Spatial Econometrics meeting in June 2018, and implemented in spdep and
sphet, but sphet has not been released since then. I just bumped the
version number of sphet on R-Forge to 1.7-2, and hope that it will let you
run install.packages("sphet", repos="http://R-Forge.R-project.org"), which
is not possible at the moment (see
https://r-forge.r-project.org/R/?group_id=477). If you can install the
development version of sphet from source, check it out by:

svn checkout svn://svn.r-forge.r-project.org/svnroot/sphet/

and run R CMD build sphet, then R CMD INSTALL that .tar.gz file.

Roger

>
> Germán
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: [hidden email]
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Roger Bivand
Department of Economics
Norwegian School of Economics
Helleveien 30
N-5045 Bergen, Norway

Impacts code after gstslshet

Fri, 01/04/2019 - 16:10
Hi,
 
My name is Germán Izón. I am currently working on a project in which I am estimating a SARAR specification using the gstslshet function. After estimating this model I tried estimating the marginal effects using the impacts function but I get the following error: “Error in spdep::intImpacts(rho = rho, beta = beta, P = P, n = n, mu = mu,  : argument "evalues" is missing, with no default”. I get the same message using the columbus data. I do not get this error after estimating a spatial lag model (e.g., lagsarlm). I would truly appreciate any help with this. Thank you!
 
Germán

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: how to get an attribute from a raster layer

Sat, 12/29/2018 - 13:04
Where did you search? My google search for "getZ package raster" found it easily. If you have loaded the raster package, then the command ?getZ brings up the manual page:

> library(raster)
Loading required package: sp
> ?getZ

--------------------------------------
David L. Carlson
Department of Anthropology
Texas A&M University


-----Original Message-----
From: R-sig-Geo [mailto:[hidden email]] On Behalf Of Antonio Silva
Sent: Friday, December 28, 2018 10:39 AM
To: Ben Tupper <[hidden email]>
Cc: R-mailing list <[hidden email]>
Subject: Re: [R-sig-Geo] how to get an attribute from a raster layer

Dear Ben

Thanks again. I didn't find this function in my search.

Happy new year to all.

Antonio Olinto

Em sex, 28 de dez de 2018 às 13:19, Ben Tupper <[hidden email]>
escreveu:

> Hi,
>
> You are looking for raster::getZ() but be aware that the Z value can be of
> any type - in this case I would guess it is a Date class so you will need
> to cast it to character using format() to get a label you desire.
>
>
> https://www.rdocumentation.org/packages/raster/versions/2.8-4/topics/z-values
>
>
> Cheers,
> Ben
>
> On Dec 28, 2018, at 10:04 AM, Antonio Silva <[hidden email]> wrote:
>
> Dear list members
>
> I need help to do something that should be easy but I could not execute.
>
> I just want to plot a raster layer and use "z-value" as the title.
>
> rst.data[[1]]
> class       : RasterLayer
> band        : 1  (of  4  bands)
> dimensions  : 33, 45, 1485  (nrow, ncol, ncell)
> resolution  : 0.25, 0.25  (x, y)
> extent      : -50.25, -39, -29, -20.75  (xmin, xmax, ymin, ymax)
> coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
> data source : /mnt/.../dataset-sss-ssd-rep-monthly_2016-11-12_sos.nc
> names       : X2016.11.15.1
> z-value     : 2016-11-15
> zvar        : sos
>
> Is it possible to extract the z-value value directly (2016-11-15)?
>
> The best I could do was
>
> plot(rst.data[[1]],main=substr(names(rst.data[[1]]),2,11))
>
> Thanks a lot
>
> Antonio Olinto
> Fisheries Institute
> São Paulo, Brazil
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org
>
> Ecological Forecasting: https://eco.bigelow.org/
>
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: how to get an attribute from a raster layer

Fri, 12/28/2018 - 10:39
Dear Ben

Thanks again. I didn't find this function in my search.

Happy new year to all.

Antonio Olinto

Em sex, 28 de dez de 2018 às 13:19, Ben Tupper <[hidden email]>
escreveu:

> Hi,
>
> You are looking for raster::getZ() but be aware that the Z value can be of
> any type - in this case I would guess it is a Date class so you will need
> to cast it to character using format() to get a label you desire.
>
>
> https://www.rdocumentation.org/packages/raster/versions/2.8-4/topics/z-values
>
>
> Cheers,
> Ben
>
> On Dec 28, 2018, at 10:04 AM, Antonio Silva <[hidden email]> wrote:
>
> Dear list members
>
> I need help to do something that should be easy but I could not execute.
>
> I just want to plot a raster layer and use "z-value" as the title.
>
> rst.data[[1]]
> class       : RasterLayer
> band        : 1  (of  4  bands)
> dimensions  : 33, 45, 1485  (nrow, ncol, ncell)
> resolution  : 0.25, 0.25  (x, y)
> extent      : -50.25, -39, -29, -20.75  (xmin, xmax, ymin, ymax)
> coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
> data source : /mnt/.../dataset-sss-ssd-rep-monthly_2016-11-12_sos.nc
> names       : X2016.11.15.1
> z-value     : 2016-11-15
> zvar        : sos
>
> Is it possible to extract the z-value value directly (2016-11-15)?
>
> The best I could do was
>
> plot(rst.data[[1]],main=substr(names(rst.data[[1]]),2,11))
>
> Thanks a lot
>
> Antonio Olinto
> Fisheries Institute
> São Paulo, Brazil
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org
>
> Ecological Forecasting: https://eco.bigelow.org/
>
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: how to get an attribute from a raster layer

Fri, 12/28/2018 - 09:19
Hi,

You are looking for raster::getZ() but be aware that the Z value can be of any type - in this case I would guess it is a Date class so you will need to cast it to character using format() to get a label you desire.

https://www.rdocumentation.org/packages/raster/versions/2.8-4/topics/z-values


Cheers,
Ben
> On Dec 28, 2018, at 10:04 AM, Antonio Silva <[hidden email]> wrote:
>
> Dear list members
>
> I need help to do something that should be easy but I could not execute.
>
> I just want to plot a raster layer and use "z-value" as the title.
>
> rst.data[[1]]
> class       : RasterLayer
> band        : 1  (of  4  bands)
> dimensions  : 33, 45, 1485  (nrow, ncol, ncell)
> resolution  : 0.25, 0.25  (x, y)
> extent      : -50.25, -39, -29, -20.75  (xmin, xmax, ymin, ymax)
> coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
> data source : /mnt/.../dataset-sss-ssd-rep-monthly_2016-11-12_sos.nc
> names       : X2016.11.15.1
> z-value     : 2016-11-15
> zvar        : sos
>
> Is it possible to extract the z-value value directly (2016-11-15)?
>
> The best I could do was
>
> plot(rst.data[[1]],main=substr(names(rst.data[[1]]),2,11))
>
> Thanks a lot
>
> Antonio Olinto
> Fisheries Institute
> São Paulo, Brazil
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org

Ecological Forecasting: https://eco.bigelow.org/






        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

how to get an attribute from a raster layer

Fri, 12/28/2018 - 09:04
Dear list members

I need help to do something that should be easy but I could not execute.

I just want to plot a raster layer and use "z-value" as the title.

rst.data[[1]]
class       : RasterLayer
band        : 1  (of  4  bands)
dimensions  : 33, 45, 1485  (nrow, ncol, ncell)
resolution  : 0.25, 0.25  (x, y)
extent      : -50.25, -39, -29, -20.75  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0
data source : /mnt/.../dataset-sss-ssd-rep-monthly_2016-11-12_sos.nc
names       : X2016.11.15.1
z-value     : 2016-11-15
zvar        : sos

Is it possible to extract the z-value value directly (2016-11-15)?

The best I could do was

plot(rst.data[[1]],main=substr(names(rst.data[[1]]),2,11))

Thanks a lot

Antonio Olinto
Fisheries Institute
São Paulo, Brazil

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: get data from nc file

Thu, 12/27/2018 - 11:15
Thanks for you nice idea and code Ben. I will use them for sure.

Have a wonderful 2019. All the best

Antonio Olinto
Fisheries Institute
Brazil


Em qua, 26 de dez de 2018 às 22:01, Ben Tupper <[hidden email]>
escreveu:

> Hi,
>
> .  I don't think there is any other way as the attributes are sort of
> buried in the string; that's unfortunate.  I guess you could at least make
> a reusable function assuming you'll be doing this again or looking to pull
> other attributes.  Something like this...
>
>
> #' Extract one of the GLobal Attributes of a TRMM NetCDF as a named vector
> #'
> #' @param nc the ncdf4 object
> #' @param name the name of the global attribute
> #' @param sep the separator used to delimit fields in the attribute
> #' @return named character vector of attributes
> nc_att_split <- function(nc, name = "FileHeader", sep = ";\n"){
>
>         a1 <- ncdf4::ncatt_get(nc, 0)[[name[1]]]
>         if (is.null(a1)) return(a1)
>
>         a2 <- strsplit(a1,";\n", fixed = TRUE)[[1]]
>         aa <- strsplit(a2, "=", fixed = TRUE)
>
>         x <- sapply(aa,
>                 function(s) x = if(length(s) <= 1) "" else s[2]
>                 )
>         names(x) <- sapply(aa,
>                 function(s) x = if(length(s) <= 1) "unknown" else s[1]
>                 )
>
>         x
> }
>
>
> nc <- ncdf4::nc_open("3B43.20080101.7A.HDF.nc")
> x <- nc_att_split(nc)
> as.Date(x[['StartGranuleDateTime']], format = "%Y-%m-%dT%H:%M:%OSZ")
> [1] "2008-01-01"
>
>
> Cheers,
> Ben
>
> > On Dec 26, 2018, at 3:42 PM, Antonio Silva <[hidden email]>
> wrote:
> >
> > Dear list members
> >
> > I downloaded some nc files with precipitation data from
> > https://pmm.nasa.gov/data-access/downloads/trmm (Level 3 3B43:
> > Multisatellite Precipitation). For the image link see the global
> attribute
> > "history" (below).
> >
> > With ncdf4::nc_open I cloud open the file (nc.data <- nc_open("
> > 3B43.20080101.7A.HDF.nc")
> >
> > I want to extract the "StartGranuleDateTime" but it is inside the global
> > attribute FileHeader (see below).
> >
> > With ncatt_get(nc.data,0,"FileHeader")$value I got
> > [1]
> >
> "AlgorithmID=3B43;\nAlgorithmVersion=3B43_7.0;\nFileName=3B43.20080101.7A.HDF;\nGenerationDateTime=2012-11-29T19:12:01.000Z;\nStartGranuleDateTime=2008-01-01T00:00:00.000Z;\nStopGranuleDateTime=2008-01-31T23:59:59.999Z;\nGranuleNumber=;\nNumberOfSwaths=0;\nNumberOfGrids=1;\nGranuleStart=;\nTimeInterval=MONTH;\nProcessingSystem=PPS;\nProductVersion=7A;\nMissingData=;\n"
> >
> > Is there any way to extract only the string "2008-01-01T00:00:00.000Z"?
> >
> > The best I could do was
> >
> as.Date(substr(strsplit(ncatt_get(nc.data,0,"FileHeader")$value,";\n")[[1]][5],22,45),"%Y-%m-%dT%H:%M:%OSZ")
> >
> > but probably, I suppose, there must be a more direct way of getting the
> > data. I appreciate any suggestions.
> >
> > Best regards,
> >
> > Antonio Olinto
> > Fisheries Institute
> > Brazil
> >
> > nc.data
> > File 3B43.20080101.7A.HDF.nc (NC_FORMAT_CLASSIC):
> >
> >     1 variables (excluding dimension variables):
> >        float precipitation[nlat,nlon]
> >            units: mm/hr
> >            coordinates: nlon nlat
> >            _FillValue: -9999.900390625
> >
> >     2 dimensions:
> >        nlon  Size:33
> >            long_name: longitude
> >            standard_name: longitude
> >            units: degrees_east
> >        nlat  Size:41
> >            long_name: latitude
> >            standard_name: latitude
> >            units: degrees_north
> >
> >    5 global attributes:
> >        Grid.GridHeader: BinMethod=ARITHMETIC_MEAN;
> > Registration=CENTER;
> > LatitudeResolution=0.25;
> > LongitudeResolution=0.25;
> > NorthBoundingCoordinate=50;
> > SouthBoundingCoordinate=-50;
> > EastBoundingCoordinate=180;
> > WestBoundingCoordinate=-180;
> > Origin=SOUTHWEST;
> >
> >        FileHeader: AlgorithmID=3B43;
> > AlgorithmVersion=3B43_7.0;
> > FileName=3B43.20080101.7A.HDF;
> > GenerationDateTime=2012-11-29T19:12:01.000Z;
> > StartGranuleDateTime=2008-01-01T00:00:00.000Z;
> > StopGranuleDateTime=2008-01-31T23:59:59.999Z;
> > GranuleNumber=;
> > NumberOfSwaths=0;
> > NumberOfGrids=1;
> > GranuleStart=;
> > TimeInterval=MONTH;
> > ProcessingSystem=PPS;
> > ProductVersion=7A;
> > MissingData=;
> >
> >        FileInfo: DataFormatVersion=m;
> > TKCodeBuildVersion=1;
> > MetadataVersion=m;
> > FormatPackage=HDF Version 4.2 Release 4, January 25, 2009;
> > BlueprintFilename=TRMM.V7.3B43.blueprint.xml;
> > BlueprintVersion=BV_13;
> > TKIOVersion=1.6;
> > MetadataStyle=PVL;
> > EndianType=LITTLE_ENDIAN;
> >
> >        GridHeader: BinMethod=ARITHMETIC_MEAN;
> > Registration=CENTER;
> > LatitudeResolution=0.25;
> > LongitudeResolution=0.25;
> > NorthBoundingCoordinate=50;
> > SouthBoundingCoordinate=-50;
> > EastBoundingCoordinate=180;
> > WestBoundingCoordinate=-180;
> > Origin=SOUTHWEST;
> >
> >        history: 2018-12-26 17:57:56 GMT Hyrax-1.13.4
> >
> https://disc2.gesdisc.eosdis.nasa.gov:443/opendap/TRMM_L3/TRMM_3B43.7/2008/3B43.20080101.7A.HDF.nc?precipitation[604:636][3:43],nlat[3:43],nlon[604:636]
> >
> >       [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > [hidden email]
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
> Ben Tupper
> Bigelow Laboratory for Ocean Sciences
> 60 Bigelow Drive, P.O. Box 380
> East Boothbay, Maine 04544
> http://www.bigelow.org
>
> Ecological Forecasting: https://eco.bigelow.org
        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Re: get data from nc file

Wed, 12/26/2018 - 18:01
Hi,

Yikes.  I don't think there is any other way as the attributes are sort of buried in the string; that's unfortunate.  I guess you could at least make a reusable function assuming you'll be doing this again or looking to pull other attributes.  Something like this...


#' Extract one of the GLobal Attributes of a TRMM NetCDF as a named vector
#'
#' @param nc the ncdf4 object
#' @param name the name of the global attribute
#' @param sep the separator used to delimit fields in the attribute
#' @return named character vector of attributes
nc_att_split <- function(nc, name = "FileHeader", sep = ";\n"){
       
        a1 <- ncdf4::ncatt_get(nc, 0)[[name[1]]]
        if (is.null(a1)) return(a1)
       
        a2 <- strsplit(a1,";\n", fixed = TRUE)[[1]]
        aa <- strsplit(a2, "=", fixed = TRUE)
       
        x <- sapply(aa,
                function(s) x = if(length(s) <= 1) "" else s[2]
                )
        names(x) <- sapply(aa,
                function(s) x = if(length(s) <= 1) "unknown" else s[1]
                )
       
        x
}


nc <- ncdf4::nc_open("3B43.20080101.7A.HDF.nc")
x <- nc_att_split(nc)
as.Date(x[['StartGranuleDateTime']], format = "%Y-%m-%dT%H:%M:%OSZ")
[1] "2008-01-01"


Cheers,
Ben

> On Dec 26, 2018, at 3:42 PM, Antonio Silva <[hidden email]> wrote:
>
> Dear list members
>
> I downloaded some nc files with precipitation data from
> https://pmm.nasa.gov/data-access/downloads/trmm (Level 3 3B43:
> Multisatellite Precipitation). For the image link see the global attribute
> "history" (below).
>
> With ncdf4::nc_open I cloud open the file (nc.data <- nc_open("
> 3B43.20080101.7A.HDF.nc")
>
> I want to extract the "StartGranuleDateTime" but it is inside the global
> attribute FileHeader (see below).
>
> With ncatt_get(nc.data,0,"FileHeader")$value I got
> [1]
> "AlgorithmID=3B43;\nAlgorithmVersion=3B43_7.0;\nFileName=3B43.20080101.7A.HDF;\nGenerationDateTime=2012-11-29T19:12:01.000Z;\nStartGranuleDateTime=2008-01-01T00:00:00.000Z;\nStopGranuleDateTime=2008-01-31T23:59:59.999Z;\nGranuleNumber=;\nNumberOfSwaths=0;\nNumberOfGrids=1;\nGranuleStart=;\nTimeInterval=MONTH;\nProcessingSystem=PPS;\nProductVersion=7A;\nMissingData=;\n"
>
> Is there any way to extract only the string "2008-01-01T00:00:00.000Z"?
>
> The best I could do was
> as.Date(substr(strsplit(ncatt_get(nc.data,0,"FileHeader")$value,";\n")[[1]][5],22,45),"%Y-%m-%dT%H:%M:%OSZ")
>
> but probably, I suppose, there must be a more direct way of getting the
> data. I appreciate any suggestions.
>
> Best regards,
>
> Antonio Olinto
> Fisheries Institute
> Brazil
>
> nc.data
> File 3B43.20080101.7A.HDF.nc (NC_FORMAT_CLASSIC):
>
>     1 variables (excluding dimension variables):
>        float precipitation[nlat,nlon]
>            units: mm/hr
>            coordinates: nlon nlat
>            _FillValue: -9999.900390625
>
>     2 dimensions:
>        nlon  Size:33
>            long_name: longitude
>            standard_name: longitude
>            units: degrees_east
>        nlat  Size:41
>            long_name: latitude
>            standard_name: latitude
>            units: degrees_north
>
>    5 global attributes:
>        Grid.GridHeader: BinMethod=ARITHMETIC_MEAN;
> Registration=CENTER;
> LatitudeResolution=0.25;
> LongitudeResolution=0.25;
> NorthBoundingCoordinate=50;
> SouthBoundingCoordinate=-50;
> EastBoundingCoordinate=180;
> WestBoundingCoordinate=-180;
> Origin=SOUTHWEST;
>
>        FileHeader: AlgorithmID=3B43;
> AlgorithmVersion=3B43_7.0;
> FileName=3B43.20080101.7A.HDF;
> GenerationDateTime=2012-11-29T19:12:01.000Z;
> StartGranuleDateTime=2008-01-01T00:00:00.000Z;
> StopGranuleDateTime=2008-01-31T23:59:59.999Z;
> GranuleNumber=;
> NumberOfSwaths=0;
> NumberOfGrids=1;
> GranuleStart=;
> TimeInterval=MONTH;
> ProcessingSystem=PPS;
> ProductVersion=7A;
> MissingData=;
>
>        FileInfo: DataFormatVersion=m;
> TKCodeBuildVersion=1;
> MetadataVersion=m;
> FormatPackage=HDF Version 4.2 Release 4, January 25, 2009;
> BlueprintFilename=TRMM.V7.3B43.blueprint.xml;
> BlueprintVersion=BV_13;
> TKIOVersion=1.6;
> MetadataStyle=PVL;
> EndianType=LITTLE_ENDIAN;
>
>        GridHeader: BinMethod=ARITHMETIC_MEAN;
> Registration=CENTER;
> LatitudeResolution=0.25;
> LongitudeResolution=0.25;
> NorthBoundingCoordinate=50;
> SouthBoundingCoordinate=-50;
> EastBoundingCoordinate=180;
> WestBoundingCoordinate=-180;
> Origin=SOUTHWEST;
>
>        history: 2018-12-26 17:57:56 GMT Hyrax-1.13.4
> https://disc2.gesdisc.eosdis.nasa.gov:443/opendap/TRMM_L3/TRMM_3B43.7/2008/3B43.20080101.7A.HDF.nc?precipitation[604:636][3:43],nlat[3:43],nlon[604:636]
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org

Ecological Forecasting: https://eco.bigelow.org/

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

get data from nc file

Wed, 12/26/2018 - 14:42
Dear list members

I downloaded some nc files with precipitation data from
https://pmm.nasa.gov/data-access/downloads/trmm (Level 3 3B43:
Multisatellite Precipitation). For the image link see the global attribute
"history" (below).

With ncdf4::nc_open I cloud open the file (nc.data <- nc_open("
3B43.20080101.7A.HDF.nc")

I want to extract the "StartGranuleDateTime" but it is inside the global
attribute FileHeader (see below).

With ncatt_get(nc.data,0,"FileHeader")$value I got
[1]
"AlgorithmID=3B43;\nAlgorithmVersion=3B43_7.0;\nFileName=3B43.20080101.7A.HDF;\nGenerationDateTime=2012-11-29T19:12:01.000Z;\nStartGranuleDateTime=2008-01-01T00:00:00.000Z;\nStopGranuleDateTime=2008-01-31T23:59:59.999Z;\nGranuleNumber=;\nNumberOfSwaths=0;\nNumberOfGrids=1;\nGranuleStart=;\nTimeInterval=MONTH;\nProcessingSystem=PPS;\nProductVersion=7A;\nMissingData=;\n"

Is there any way to extract only the string "2008-01-01T00:00:00.000Z"?

The best I could do was
as.Date(substr(strsplit(ncatt_get(nc.data,0,"FileHeader")$value,";\n")[[1]][5],22,45),"%Y-%m-%dT%H:%M:%OSZ")

but probably, I suppose, there must be a more direct way of getting the
data. I appreciate any suggestions.

Best regards,

Antonio Olinto
Fisheries Institute
Brazil

nc.data
File 3B43.20080101.7A.HDF.nc (NC_FORMAT_CLASSIC):

     1 variables (excluding dimension variables):
        float precipitation[nlat,nlon]
            units: mm/hr
            coordinates: nlon nlat
            _FillValue: -9999.900390625

     2 dimensions:
        nlon  Size:33
            long_name: longitude
            standard_name: longitude
            units: degrees_east
        nlat  Size:41
            long_name: latitude
            standard_name: latitude
            units: degrees_north

    5 global attributes:
        Grid.GridHeader: BinMethod=ARITHMETIC_MEAN;
Registration=CENTER;
LatitudeResolution=0.25;
LongitudeResolution=0.25;
NorthBoundingCoordinate=50;
SouthBoundingCoordinate=-50;
EastBoundingCoordinate=180;
WestBoundingCoordinate=-180;
Origin=SOUTHWEST;

        FileHeader: AlgorithmID=3B43;
AlgorithmVersion=3B43_7.0;
FileName=3B43.20080101.7A.HDF;
GenerationDateTime=2012-11-29T19:12:01.000Z;
StartGranuleDateTime=2008-01-01T00:00:00.000Z;
StopGranuleDateTime=2008-01-31T23:59:59.999Z;
GranuleNumber=;
NumberOfSwaths=0;
NumberOfGrids=1;
GranuleStart=;
TimeInterval=MONTH;
ProcessingSystem=PPS;
ProductVersion=7A;
MissingData=;

        FileInfo: DataFormatVersion=m;
TKCodeBuildVersion=1;
MetadataVersion=m;
FormatPackage=HDF Version 4.2 Release 4, January 25, 2009;
BlueprintFilename=TRMM.V7.3B43.blueprint.xml;
BlueprintVersion=BV_13;
TKIOVersion=1.6;
MetadataStyle=PVL;
EndianType=LITTLE_ENDIAN;

        GridHeader: BinMethod=ARITHMETIC_MEAN;
Registration=CENTER;
LatitudeResolution=0.25;
LongitudeResolution=0.25;
NorthBoundingCoordinate=50;
SouthBoundingCoordinate=-50;
EastBoundingCoordinate=180;
WestBoundingCoordinate=-180;
Origin=SOUTHWEST;

        history: 2018-12-26 17:57:56 GMT Hyrax-1.13.4
https://disc2.gesdisc.eosdis.nasa.gov:443/opendap/TRMM_L3/TRMM_3B43.7/2008/3B43.20080101.7A.HDF.nc?precipitation[604:636][3:43],nlat[3:43],nlon[604:636]

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Pages