Re: [R-sig-Geo] Extract VIIRS data in R

2020-03-18 Thread Edzer Pebesma
If the product info is in this document:
https://ladsweb.modaps.eosdis.nasa.gov/missions-and-measurements/viirs/NASAVIIRSL1BUGAug2019.pdf

then it sounds like these data are distributed as curvilinear grids,
meaning that there are two additional raster with for each pixel the
longitude and the latitude. The file you pointed to does not contain
these two grids, but you should be able to get them at the place where
you got the data. With that, you can use package stars to load them, and
e.g. resample to some (more) regular grid.

See e.g.
https://r-spatial.github.io/stars/articles/stars4.html#curvilinear-grids

On 3/18/20 3:29 PM, Michael Sumner wrote:
> You won't find much on this kind of file in the R community, this is
> relatively new NetCDF-4 with "groups", and contains a satellite "granule" -
> a kind of pre-mapping raw data array with only technical information about
> where the scanning occurred.
> 
> In short, raster and stars package (and RNetCDF and ncdf4) will read the
> data from this file, but give very little or no help for how to treat it
> like a map. The spatial resolution and extent are purely nominal as shown
> by raster, a spacing of 1 in two dimensions and extending from 0 to nrows,
> 0 to ncols (with a  half cell shift). There aren't any coordinate arrays in
> the file, or any simple way to transform from this matrix-space to
> geography as far as I know.  (Would love to be corrected on how to do
> that).
> 
> You'd need to pursue domain-specific expertise to discover the mapping of
> this, unless some kind soul turns up to help here. I expect you'll want to
> find a product that has been converted into simpler form for these data.
> 
> Cheers, Mike.
> 
> 
> On Wed, Mar 18, 2020 at 1:39 AM Miluji Sb  wrote:
> 
>> Dear all,
>>
>> Hope everyone is keeping safe.
>>
>> I am trying to extract/read VIIRS nighttime lights data but the output
>> seems rather strange.
>>
>> I have uploaded the file here
>>  so as
>> not exceed the size limit of the email.
>>
>> ## Code ##
>> library(ncdf4)
>> library(rgdal)
>>
>> netcdf_file <- c("VNP02DNB_NRT.A2020069.1048.001.nc")
>> nl <- brick(netcdf_file, lvar=0, values=TRUE,
>> varname="observation_data/DNB_observations")
>>
>> ## Detail ##
>> class  : RasterLayer
>> dimensions : 3232, 4064, 13134848  (nrow, ncol, ncell)
>> resolution : 1, 1  (x, y)
>> extent : 0.5, 4064.5, 0.5, 3232.5  (xmin, xmax, ymin, ymax)
>> crs: NA
>> source : C:/Users/shour/Desktop/VNP02DNB_NRT.A2020069.1048.001.nc
>> names  : DNB.observations.at.pixel.locations
>> zvar   : observation_data/DNB_observations
>>
>> The spatial resolution is supposed to be 750m but this shows 1°. What am I
>> doing wrong? Any help will be greatly appreciated. Thank you.
>>
>> Sincerely,
>>
>> Millu
>>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-sig-Geo mailing list
>> R-sig-Geo@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
> 
> 

-- 
Edzer Pebesma
Institute for Geoinformatics
Heisenbergstrasse 2, 48149 Muenster, Germany
Phone: +49 251 8333081


pEpkey.asc
Description: application/pgp-keys
___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] rgdal travis error: configure: error: gdal-config not found or not executable.

2020-03-18 Thread Edzer Pebesma
At least libgdal-dev and libproj-dev are missing. You can have a look at
https://github.com/r-spatial/sf/blob/master/.travis.yml (but that tries
to do quite a bit more).

On 3/18/20 3:21 PM, Joe Lewis wrote:
> Hi,
> 
> I'm testing a package using travis and I keep getting an error message
> about rgdal not being found or executable. I've been trying to piece
> together things I've found online but to no avail.
> 
> https://travis-ci.org/github/josephlewis/leastcostpath/builds/663944787
> 
> travis.yml
> 
> # R for travis: see documentation at
> https://docs.travis-ci.com/user/languages/r
> 
> language: R
> sudo: false
> cache: packages
> 
> repos:
>   CRAN: https://cran.rstudio.com
>   rforge: http://R-Forge.R-project.org
> 
> apt_packages:
> - gdal-bin
> 
> before_install:
> install.packages("rgdal", repos="http://R-Forge.R-project.org;)
> 
> 
> Any help would be appreciated.
> 
> Thanks.
> 
> Kind regards,
> Joseph Lewis
> 
>   [[alternative HTML version deleted]]
> 
> ___
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Edzer Pebesma
Institute for Geoinformatics
Heisenbergstrasse 2, 48149 Muenster, Germany
Phone: +49 251 8333081


pEpkey.asc
Description: application/pgp-keys
___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] Merging Shape files

2020-03-18 Thread Zia Ahmed
You welcome.

If you are interested in geospatial analysis in python, you check this:

https://zia207.github.io/geospatial-python.io/

Best
Zia

On Wed, Mar 18, 2020, 10:45 AM Dexter Locke  wrote:

> Zia: this is a fabulous resource!!
>
> Thanks for sharing,
> Dexter
>
>
> On Wed, Mar 18, 2020 at 10:37 AM Zia Ahmed  wrote:
>
>> Please  check this:
>>
>>
>> https://zia207.github.io/geospatial-r-github.io/geoprocessing-vector-data.html
>> Best
>> Zia
>>
>> On Tue, Mar 17, 2020, 10:39 AM Dexter Locke 
>> wrote:
>>
>>> Within st_join() see the options like "left = TRUE".
>>>
>>> You may also want to look at st_intersects()
>>>
>>> Here are other helpful reference websites:
>>> https://r-spatial.github.io/sf/reference/geos_binary_pred.html
>>>
>>> https://cran.r-project.org/web/packages/sf/vignettes/sf3.html
>>>
>>> -Dexter
>>>
>>>
>>> On Tue, Mar 17, 2020 at 10:29 AM El Mechry El Koudouss <
>>> eelkoudo...@fordham.edu> wrote:
>>>
>>> > Dear readers,
>>> > I downloaded a shapefile with data on crime incidents in Washington DC
>>> in
>>> > 2016 (available here:
>>> > https://opendata.dc.gov/datasets/crime-incidents-in-2016) and another
>>> > shapefile with data on parks and recreation areas, also in Washington
>>> DC
>>> > (available here:
>>> > https://opendata.dc.gov/datasets/parks-and-recreation-areas).
>>> > I was able to read both shapefiles using st_read() from the sf
>>> package. My
>>> > question is, how can I merge the two data sets? I tried st_join() but
>>> it
>>> > simply resulted in empty columns from the parks dataset getting added
>>> to
>>> > the crime data. Any guidance would be much appreciated.
>>> > library(sf)
>>> > parks <- st_read("Parks_and_Recreation_Areas.shp")
>>> > crime <- st_read("Crime_Incidents_in_2016.shp")
>>> > df <- st_join(crime, parks)
>>> >
>>> > --
>>> > El Mechry, El Koudouss (Meshry)
>>> > Graduate Research Assistant
>>> > Center for International Policy Studies
>>> > Fordham University
>>> > Department of Economics
>>> > Website: www.meshry.com
>>> >
>>> > [[alternative HTML version deleted]]
>>> >
>>> > ___
>>> > R-sig-Geo mailing list
>>> > R-sig-Geo@r-project.org
>>> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>> >
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> ___
>>> R-sig-Geo mailing list
>>> R-sig-Geo@r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] Extract VIIRS data in R

2020-03-18 Thread Miluji Sb
Dear all,

Thank you everyone. The issue (as pointed out) is the following;

# [1] "vobjtovarid4:  WARNING  I was asked to get a varid for
dimension named number_of_pixels BUT this dimension HAS NO DIMVAR! Code
will probably fail at this point"

I have contacted the VIIRS people and will keep you posted here. Thank you
again!

Best,

Milu

On Wed, Mar 18, 2020 at 3:34 PM Zia Ahmed  wrote:

> This is might help you:
>
> https://zia207.github.io/geospatial-r-github.io/netCDF-data-processing.html
>
>
> Zia
>
> On Wed, Mar 18, 2020, 9:34 AM Frederico Faleiro 
> wrote:
>
>> Hi Miluji,
>>
>> the R in general do not handle very well with netCDF. However I
>> recommend you use the netcdf4 package before try others.
>> This link is a good start:
>>
>> http://geog.uoregon.edu/bartlein/courses/geog490/week04-netCDF.html#get-coordinate-including-time-variables
>> .
>> The coordinates of this file is not in longitude and latitude, it use
>> "number_of_lines" for X Axis and "number_of_pixels" for Y Axis. This way
>> the difference between the cells is always one and raster package
>> interprete the difference as one degree and return an warning about it.
>> I open the file in the software Panoply (design to work with netCDF)  and
>> everything is OK apparently.
>> Check bellow some exploration of the data in R.
>>
>> library(raster)
>> library(ncdf4)
>> library(rgdal)
>>
>> # netcdf4 package
>> netcdf_file <- "VNP02DNB_NRT.A2020069.1048.001.nc"
>> nc <- nc_open(netcdf_file)
>> print(nc)
>> # check your variable is structured as:
>> observation_data/DNB_observations[number_of_pixels,number_of_lines]
>> # variables available
>> names(nc[["var"]])
>> # properties from your variable
>> ncatt_get(nc, "observation_data/DNB_observations")
>> # get the variables values and check the structure
>> obs_matrix <- ncvar_get(nc, "observation_data/DNB_observations")
>> str(obs_matrix)
>>
>> # raster package
>> nc_r <- brick(netcdf_file, lvar=0, values=TRUE,
>> varname="observation_data/DNB_observations")
>> # [1] "vobjtovarid4:  WARNING  I was asked to get a varid for
>> dimension named number_of_pixels BUT this dimension HAS NO DIMVAR! Code
>> will probably fail at this point"
>> # [1] "vobjtovarid4:  WARNING  I was asked to get a varid for
>> dimension named number_of_lines BUT this dimension HAS NO DIMVAR! Code
>> will
>> probably fail at this point"
>>
>> Best regards,
>>
>> Frederico Faleiro
>> Postdoctoral Researcher in the INCT-EECBio (https://www.eecbio.ufg.br/)
>> Federal University of Goiás | Brazil
>> RG: https://www.researchgate.net/profile/Frederico_Faleiro
>>
>> On Tue, Mar 17, 2020 at 11:39 AM Miluji Sb  wrote:
>>
>> > Dear all,
>> >
>> > Hope everyone is keeping safe.
>> >
>> > I am trying to extract/read VIIRS nighttime lights data but the output
>> > seems rather strange.
>> >
>> > I have uploaded the file here
>> > 
>> so as
>> > not exceed the size limit of the email.
>> >
>> > ## Code ##
>> > library(ncdf4)
>> > library(rgdal)
>> >
>> > netcdf_file <- c("VNP02DNB_NRT.A2020069.1048.001.nc")
>> > nl <- brick(netcdf_file, lvar=0, values=TRUE,
>> > varname="observation_data/DNB_observations")
>> >
>> > ## Detail ##
>> > class  : RasterLayer
>> > dimensions : 3232, 4064, 13134848  (nrow, ncol, ncell)
>> > resolution : 1, 1  (x, y)
>> > extent : 0.5, 4064.5, 0.5, 3232.5  (xmin, xmax, ymin, ymax)
>> > crs: NA
>> > source : C:/Users/shour/Desktop/VNP02DNB_NRT.A2020069.1048.001.nc
>> > names  : DNB.observations.at.pixel.locations
>> > zvar   : observation_data/DNB_observations
>> >
>> > The spatial resolution is supposed to be 750m but this shows 1°. What
>> am I
>> > doing wrong? Any help will be greatly appreciated. Thank you.
>> >
>> > Sincerely,
>> >
>> > Millu
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > ___
>> > R-sig-Geo mailing list
>> > R-sig-Geo@r-project.org
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>> >
>>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-sig-Geo mailing list
>> R-sig-Geo@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] R spatial follows GDAL and PROJ development

2020-03-18 Thread Ben Tupper
This is very helpful - thank you!

On Wed, Mar 18, 2020 at 9:12 AM Roger Bivand  wrote:

> A new blog: "R spatial follows GDAL and PROJ development" has been
> published: https://www.r-spatial.org/r/2020/03/17/wkt.html.
>
> Those maintaining packages using sf or sp/rgdal, and authors of scripts
> using them should read the blog and be prepared to take rapid action when
> sf 0.9 is released and built using PROJ >= 6 and GDAL >= 3. An early
> release of rgdal (>= 1.5, probably 1.6.0, is also to be expected).
>
> Roger
>
> --
> Roger Bivand
> Department of Economics, Norwegian School of Economics,
> Helleveien 30, N-5045 Bergen, Norway.
> voice: +47 55 95 93 55; e-mail: roger.biv...@nhh.no
> https://orcid.org/-0003-2392-6140
> https://scholar.google.no/citations?user=AWeghB0J=en
>
> ___
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>


-- 
Ben Tupper
Bigelow Laboratory for Ocean Science
West Boothbay Harbor, Maine
http://www.bigelow.org/
https://eco.bigelow.org

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] Merging Shape files

2020-03-18 Thread Zia Ahmed
Please  check this:

https://zia207.github.io/geospatial-r-github.io/geoprocessing-vector-data.html
Best
Zia

On Tue, Mar 17, 2020, 10:39 AM Dexter Locke  wrote:

> Within st_join() see the options like "left = TRUE".
>
> You may also want to look at st_intersects()
>
> Here are other helpful reference websites:
> https://r-spatial.github.io/sf/reference/geos_binary_pred.html
>
> https://cran.r-project.org/web/packages/sf/vignettes/sf3.html
>
> -Dexter
>
>
> On Tue, Mar 17, 2020 at 10:29 AM El Mechry El Koudouss <
> eelkoudo...@fordham.edu> wrote:
>
> > Dear readers,
> > I downloaded a shapefile with data on crime incidents in Washington DC in
> > 2016 (available here:
> > https://opendata.dc.gov/datasets/crime-incidents-in-2016) and another
> > shapefile with data on parks and recreation areas, also in Washington DC
> > (available here:
> > https://opendata.dc.gov/datasets/parks-and-recreation-areas).
> > I was able to read both shapefiles using st_read() from the sf package.
> My
> > question is, how can I merge the two data sets? I tried st_join() but it
> > simply resulted in empty columns from the parks dataset getting added to
> > the crime data. Any guidance would be much appreciated.
> > library(sf)
> > parks <- st_read("Parks_and_Recreation_Areas.shp")
> > crime <- st_read("Crime_Incidents_in_2016.shp")
> > df <- st_join(crime, parks)
> >
> > --
> > El Mechry, El Koudouss (Meshry)
> > Graduate Research Assistant
> > Center for International Policy Studies
> > Fordham University
> > Department of Economics
> > Website: www.meshry.com
> >
> > [[alternative HTML version deleted]]
> >
> > ___
> > R-sig-Geo mailing list
> > R-sig-Geo@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] Extract VIIRS data in R

2020-03-18 Thread Zia Ahmed
This is might help you:

https://zia207.github.io/geospatial-r-github.io/netCDF-data-processing.html

Zia

On Wed, Mar 18, 2020, 9:34 AM Frederico Faleiro  wrote:

> Hi Miluji,
>
> the R in general do not handle very well with netCDF. However I
> recommend you use the netcdf4 package before try others.
> This link is a good start:
>
> http://geog.uoregon.edu/bartlein/courses/geog490/week04-netCDF.html#get-coordinate-including-time-variables
> .
> The coordinates of this file is not in longitude and latitude, it use
> "number_of_lines" for X Axis and "number_of_pixels" for Y Axis. This way
> the difference between the cells is always one and raster package
> interprete the difference as one degree and return an warning about it.
> I open the file in the software Panoply (design to work with netCDF)  and
> everything is OK apparently.
> Check bellow some exploration of the data in R.
>
> library(raster)
> library(ncdf4)
> library(rgdal)
>
> # netcdf4 package
> netcdf_file <- "VNP02DNB_NRT.A2020069.1048.001.nc"
> nc <- nc_open(netcdf_file)
> print(nc)
> # check your variable is structured as:
> observation_data/DNB_observations[number_of_pixels,number_of_lines]
> # variables available
> names(nc[["var"]])
> # properties from your variable
> ncatt_get(nc, "observation_data/DNB_observations")
> # get the variables values and check the structure
> obs_matrix <- ncvar_get(nc, "observation_data/DNB_observations")
> str(obs_matrix)
>
> # raster package
> nc_r <- brick(netcdf_file, lvar=0, values=TRUE,
> varname="observation_data/DNB_observations")
> # [1] "vobjtovarid4:  WARNING  I was asked to get a varid for
> dimension named number_of_pixels BUT this dimension HAS NO DIMVAR! Code
> will probably fail at this point"
> # [1] "vobjtovarid4:  WARNING  I was asked to get a varid for
> dimension named number_of_lines BUT this dimension HAS NO DIMVAR! Code will
> probably fail at this point"
>
> Best regards,
>
> Frederico Faleiro
> Postdoctoral Researcher in the INCT-EECBio (https://www.eecbio.ufg.br/)
> Federal University of Goiás | Brazil
> RG: https://www.researchgate.net/profile/Frederico_Faleiro
>
> On Tue, Mar 17, 2020 at 11:39 AM Miluji Sb  wrote:
>
> > Dear all,
> >
> > Hope everyone is keeping safe.
> >
> > I am trying to extract/read VIIRS nighttime lights data but the output
> > seems rather strange.
> >
> > I have uploaded the file here
> >  so
> as
> > not exceed the size limit of the email.
> >
> > ## Code ##
> > library(ncdf4)
> > library(rgdal)
> >
> > netcdf_file <- c("VNP02DNB_NRT.A2020069.1048.001.nc")
> > nl <- brick(netcdf_file, lvar=0, values=TRUE,
> > varname="observation_data/DNB_observations")
> >
> > ## Detail ##
> > class  : RasterLayer
> > dimensions : 3232, 4064, 13134848  (nrow, ncol, ncell)
> > resolution : 1, 1  (x, y)
> > extent : 0.5, 4064.5, 0.5, 3232.5  (xmin, xmax, ymin, ymax)
> > crs: NA
> > source : C:/Users/shour/Desktop/VNP02DNB_NRT.A2020069.1048.001.nc
> > names  : DNB.observations.at.pixel.locations
> > zvar   : observation_data/DNB_observations
> >
> > The spatial resolution is supposed to be 750m but this shows 1°. What am
> I
> > doing wrong? Any help will be greatly appreciated. Thank you.
> >
> > Sincerely,
> >
> > Millu
> >
> > [[alternative HTML version deleted]]
> >
> > ___
> > R-sig-Geo mailing list
> > R-sig-Geo@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] Extract VIIRS data in R

2020-03-18 Thread Michael Sumner
You won't find much on this kind of file in the R community, this is
relatively new NetCDF-4 with "groups", and contains a satellite "granule" -
a kind of pre-mapping raw data array with only technical information about
where the scanning occurred.

In short, raster and stars package (and RNetCDF and ncdf4) will read the
data from this file, but give very little or no help for how to treat it
like a map. The spatial resolution and extent are purely nominal as shown
by raster, a spacing of 1 in two dimensions and extending from 0 to nrows,
0 to ncols (with a  half cell shift). There aren't any coordinate arrays in
the file, or any simple way to transform from this matrix-space to
geography as far as I know.  (Would love to be corrected on how to do
that).

You'd need to pursue domain-specific expertise to discover the mapping of
this, unless some kind soul turns up to help here. I expect you'll want to
find a product that has been converted into simpler form for these data.

Cheers, Mike.


On Wed, Mar 18, 2020 at 1:39 AM Miluji Sb  wrote:

> Dear all,
>
> Hope everyone is keeping safe.
>
> I am trying to extract/read VIIRS nighttime lights data but the output
> seems rather strange.
>
> I have uploaded the file here
>  so as
> not exceed the size limit of the email.
>
> ## Code ##
> library(ncdf4)
> library(rgdal)
>
> netcdf_file <- c("VNP02DNB_NRT.A2020069.1048.001.nc")
> nl <- brick(netcdf_file, lvar=0, values=TRUE,
> varname="observation_data/DNB_observations")
>
> ## Detail ##
> class  : RasterLayer
> dimensions : 3232, 4064, 13134848  (nrow, ncol, ncell)
> resolution : 1, 1  (x, y)
> extent : 0.5, 4064.5, 0.5, 3232.5  (xmin, xmax, ymin, ymax)
> crs: NA
> source : C:/Users/shour/Desktop/VNP02DNB_NRT.A2020069.1048.001.nc
> names  : DNB.observations.at.pixel.locations
> zvar   : observation_data/DNB_observations
>
> The spatial resolution is supposed to be 750m but this shows 1°. What am I
> doing wrong? Any help will be greatly appreciated. Thank you.
>
> Sincerely,
>
> Millu
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>


-- 
Michael Sumner
Software and Database Engineer
Australian Antarctic Division
Hobart, Australia
e-mail: mdsum...@gmail.com

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


[R-sig-Geo] rgdal travis error: configure: error: gdal-config not found or not executable.

2020-03-18 Thread Joe Lewis
Hi,

I'm testing a package using travis and I keep getting an error message
about rgdal not being found or executable. I've been trying to piece
together things I've found online but to no avail.

https://travis-ci.org/github/josephlewis/leastcostpath/builds/663944787

travis.yml

# R for travis: see documentation at
https://docs.travis-ci.com/user/languages/r

language: R
sudo: false
cache: packages

repos:
  CRAN: https://cran.rstudio.com
  rforge: http://R-Forge.R-project.org

apt_packages:
- gdal-bin

before_install:
install.packages("rgdal", repos="http://R-Forge.R-project.org;)


Any help would be appreciated.

Thanks.

Kind regards,
Joseph Lewis

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] Extract VIIRS data in R

2020-03-18 Thread Washington Correia Filho
Dear Millu,

The data they use is not with the CRS set, so the displayed result is showing 
the grid points (extent: 0.5, 4064.5, 0.5, 3232.5). Then you should consult the 
VIIRS data guide so that you can organize your data, to which you need to know 
the start data for both latitude and longitude, as well as the multiplication 
factor and so you will have your data readjusted. I also have a similar problem 
to solve, if I can, I can contact you and give you the data and the scheme I 
used. See you soon.

Sincerely,
Washington L.F. Correia Filho
Postdoctoral Research Fellowship in Meteorology, UFAL, Brazil
Dr. in Climate Sciences, UFRN, Brazil
http://lattes.cnpq.br/7596712599262929
ORCID: https://orcid.org/-0002-4029-4491/


De: R-sig-Geo  em nome de Miluji Sb 

Enviado: ter�a-feira, 17 de mar�o de 2020 11:29
Para: R-sig-geo mailing list 
Assunto: [R-sig-Geo] Extract VIIRS data in R

Dear all,

Hope everyone is keeping safe.

I am trying to extract/read VIIRS nighttime lights data but the output
seems rather strange.

I have uploaded the file here
 so as
not exceed the size limit of the email.

## Code ##
library(ncdf4)
library(rgdal)

netcdf_file <- c("VNP02DNB_NRT.A2020069.1048.001.nc")
nl <- brick(netcdf_file, lvar=0, values=TRUE,
varname="observation_data/DNB_observations")

## Detail ##
class  : RasterLayer
dimensions : 3232, 4064, 13134848  (nrow, ncol, ncell)
resolution : 1, 1  (x, y)
extent : 0.5, 4064.5, 0.5, 3232.5  (xmin, xmax, ymin, ymax)
crs: NA
source : C:/Users/shour/Desktop/VNP02DNB_NRT.A2020069.1048.001.nc
names  : DNB.observations.at.pixel.locations
zvar   : observation_data/DNB_observations

The spatial resolution is supposed to be 750m but this shows 1�. What am I
doing wrong? Any help will be greatly appreciated. Thank you.

Sincerely,

Millu

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

[https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif]
  Livre de v�rus. 
www.avast.com.

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


Re: [R-sig-Geo] Extract VIIRS data in R

2020-03-18 Thread Frederico Faleiro
Hi Miluji,

the R in general do not handle very well with netCDF. However I
recommend you use the netcdf4 package before try others.
This link is a good start:
http://geog.uoregon.edu/bartlein/courses/geog490/week04-netCDF.html#get-coordinate-including-time-variables
.
The coordinates of this file is not in longitude and latitude, it use
"number_of_lines" for X Axis and "number_of_pixels" for Y Axis. This way
the difference between the cells is always one and raster package
interprete the difference as one degree and return an warning about it.
I open the file in the software Panoply (design to work with netCDF)  and
everything is OK apparently.
Check bellow some exploration of the data in R.

library(raster)
library(ncdf4)
library(rgdal)

# netcdf4 package
netcdf_file <- "VNP02DNB_NRT.A2020069.1048.001.nc"
nc <- nc_open(netcdf_file)
print(nc)
# check your variable is structured as:
observation_data/DNB_observations[number_of_pixels,number_of_lines]
# variables available
names(nc[["var"]])
# properties from your variable
ncatt_get(nc, "observation_data/DNB_observations")
# get the variables values and check the structure
obs_matrix <- ncvar_get(nc, "observation_data/DNB_observations")
str(obs_matrix)

# raster package
nc_r <- brick(netcdf_file, lvar=0, values=TRUE,
varname="observation_data/DNB_observations")
# [1] "vobjtovarid4:  WARNING  I was asked to get a varid for
dimension named number_of_pixels BUT this dimension HAS NO DIMVAR! Code
will probably fail at this point"
# [1] "vobjtovarid4:  WARNING  I was asked to get a varid for
dimension named number_of_lines BUT this dimension HAS NO DIMVAR! Code will
probably fail at this point"

Best regards,

Frederico Faleiro
Postdoctoral Researcher in the INCT-EECBio (https://www.eecbio.ufg.br/)
Federal University of Goiás | Brazil
RG: https://www.researchgate.net/profile/Frederico_Faleiro

On Tue, Mar 17, 2020 at 11:39 AM Miluji Sb  wrote:

> Dear all,
>
> Hope everyone is keeping safe.
>
> I am trying to extract/read VIIRS nighttime lights data but the output
> seems rather strange.
>
> I have uploaded the file here
>  so as
> not exceed the size limit of the email.
>
> ## Code ##
> library(ncdf4)
> library(rgdal)
>
> netcdf_file <- c("VNP02DNB_NRT.A2020069.1048.001.nc")
> nl <- brick(netcdf_file, lvar=0, values=TRUE,
> varname="observation_data/DNB_observations")
>
> ## Detail ##
> class  : RasterLayer
> dimensions : 3232, 4064, 13134848  (nrow, ncol, ncell)
> resolution : 1, 1  (x, y)
> extent : 0.5, 4064.5, 0.5, 3232.5  (xmin, xmax, ymin, ymax)
> crs: NA
> source : C:/Users/shour/Desktop/VNP02DNB_NRT.A2020069.1048.001.nc
> names  : DNB.observations.at.pixel.locations
> zvar   : observation_data/DNB_observations
>
> The spatial resolution is supposed to be 750m but this shows 1°. What am I
> doing wrong? Any help will be greatly appreciated. Thank you.
>
> Sincerely,
>
> Millu
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

[[alternative HTML version deleted]]

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo


[R-sig-Geo] R spatial follows GDAL and PROJ development

2020-03-18 Thread Roger Bivand

A new blog: "R spatial follows GDAL and PROJ development" has been
published: https://www.r-spatial.org/r/2020/03/17/wkt.html.

Those maintaining packages using sf or sp/rgdal, and authors of scripts
using them should read the blog and be prepared to take rapid action when
sf 0.9 is released and built using PROJ >= 6 and GDAL >= 3. An early
release of rgdal (>= 1.5, probably 1.6.0, is also to be expected).

Roger

--
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: roger.biv...@nhh.no
https://orcid.org/-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0J=en

___
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo