Hello Sir/Madam, I have downloaded a TRMM_LIS.nc File with lightning time series data and was trying to extract it into a CSV file but I am not sure on how to do it. I am also attaching the TRMM_LIS file via this link: https://drive.google.com/drive/u/0/folders/19nJNwPKlJaPlkHn_NGzmjMHMaoUevH04 Request if someone can guide me and thanking you in advance sownalc
Extract Lightning Flash Time series data
4 messages · Michael Sumner, sownal chand, Edzer Pebesma
I don't understand this file structure yet, but you might try tidync:
library(tidync)
## open the file and get a summary of all vars and the dimensions they use
(nc <- tidync::tidync("TRMM_LIS.nc"))
See how viewtime_lat, viewtime_lon (and others) exist on the grid
identified by "D0" (other grids include multiple dims and so have
identifiers like "D1,D2" - this concept doesn't exist in NetCDF itself but
tidync wanted to group variables by the dims they use).
The grid "D0" is not active by default, so you can do
nc |> activate("D0")
(everything is lazy up to this point, no data has been read)
Convert to dataframe with
nc |> activate("D0") |> hyper_tibble()
You can use hyper_array() to get in native array format with some informal
metadata on the output.
HTH, otherwise package stars has another approach and some similar
facilities. I often use tidync just to understand what's there, but I
might craft a solution with a different tool after I've explored. RNetCDF
will give you direct low level access to this format, for example.
Cheers, Mike
On Sun, Sep 11, 2022 at 1:22 PM sownal chand <sownalchandfms at gmail.com>
wrote:
Hello Sir/Madam, I have downloaded a TRMM_LIS.nc File with lightning time series data and was trying to extract it into a CSV file but I am not sure on how to do it. I am also attaching the TRMM_LIS file via this link: https://drive.google.com/drive/u/0/folders/19nJNwPKlJaPlkHn_NGzmjMHMaoUevH04 Request if someone can guide me and thanking you in advance sownalc [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at 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: mdsumner at gmail.com [[alternative HTML version deleted]]
Thanks Michael But i will try out your approach and let see how it goes. Kind regards Sownalc
On Sun, Sep 11, 2022, 16:51 Michael Sumner <mdsumner at gmail.com> wrote:
I don't understand this file structure yet, but you might try tidync:
library(tidync)
## open the file and get a summary of all vars and the dimensions they use
(nc <- tidync::tidync("TRMM_LIS.nc"))
See how viewtime_lat, viewtime_lon (and others) exist on the grid
identified by "D0" (other grids include multiple dims and so have
identifiers like "D1,D2" - this concept doesn't exist in NetCDF itself but
tidync wanted to group variables by the dims they use).
The grid "D0" is not active by default, so you can do
nc |> activate("D0")
(everything is lazy up to this point, no data has been read)
Convert to dataframe with
nc |> activate("D0") |> hyper_tibble()
You can use hyper_array() to get in native array format with some informal
metadata on the output.
HTH, otherwise package stars has another approach and some similar
facilities. I often use tidync just to understand what's there, but I
might craft a solution with a different tool after I've explored. RNetCDF
will give you direct low level access to this format, for example.
Cheers, Mike
On Sun, Sep 11, 2022 at 1:22 PM sownal chand <sownalchandfms at gmail.com>
wrote:
Hello Sir/Madam, I have downloaded a TRMM_LIS.nc File with lightning time series data and was trying to extract it into a CSV file but I am not sure on how to do it. I am also attaching the TRMM_LIS file via this link: https://drive.google.com/drive/u/0/folders/19nJNwPKlJaPlkHn_NGzmjMHMaoUevH04 Request if someone can guide me and thanking you in advance sownalc [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at 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: mdsumner at gmail.com
1 day later
Someone tried to pack a lot of different things in that netcdf file! Is there one particular variable that is of main interest to you? AFAICT the primary observations seem like (long,lat,time,something_measured) sets, as if along a trajectory. Finding the variables that depend on dimension viewtime_dim give you 2097 records of them. Package stars is not so well equiped for one-dimensional arrays - sf would be more suitable in terms of data structure but GDAL doesn't seem to understand the file to contain vector (POINT) geometries. I think I would go for using packages like RNetCDF or ncdf4 and extracting the one-dimensional variables of interest, then cbind-ing them.
On 11/09/2022 07:16, sownal chand wrote:
Thanks Michael But i will try out your approach and let see how it goes. Kind regards Sownalc On Sun, Sep 11, 2022, 16:51 Michael Sumner <mdsumner at gmail.com> wrote:
I don't understand this file structure yet, but you might try tidync:
library(tidync)
## open the file and get a summary of all vars and the dimensions they use
(nc <- tidync::tidync("TRMM_LIS.nc"))
See how viewtime_lat, viewtime_lon (and others) exist on the grid
identified by "D0" (other grids include multiple dims and so have
identifiers like "D1,D2" - this concept doesn't exist in NetCDF itself but
tidync wanted to group variables by the dims they use).
The grid "D0" is not active by default, so you can do
nc |> activate("D0")
(everything is lazy up to this point, no data has been read)
Convert to dataframe with
nc |> activate("D0") |> hyper_tibble()
You can use hyper_array() to get in native array format with some informal
metadata on the output.
HTH, otherwise package stars has another approach and some similar
facilities. I often use tidync just to understand what's there, but I
might craft a solution with a different tool after I've explored. RNetCDF
will give you direct low level access to this format, for example.
Cheers, Mike
On Sun, Sep 11, 2022 at 1:22 PM sownal chand <sownalchandfms at gmail.com>
wrote:
Hello Sir/Madam, I have downloaded a TRMM_LIS.nc File with lightning time series data and was trying to extract it into a CSV file but I am not sure on how to do it. I am also attaching the TRMM_LIS file via this link: https://drive.google.com/drive/u/0/folders/19nJNwPKlJaPlkHn_NGzmjMHMaoUevH04 Request if someone can guide me and thanking you in advance sownalc [[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at 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: mdsumner at gmail.com
[[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Edzer Pebesma Institute for Geoinformatics Heisenbergstrasse 2, 48151 Muenster, Germany Phone: +49 251 8333081