Fwd: Re help with parsing grc/grd files in python

Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Fwd: Re help with parsing grc/grd files in python

Venkat Gorripati
Hi

 

I am trying to parse some .grc/.grd/.tab files (mapinfo Gis tool files) and get some data as data-frame and write to Hive

 

One of my colleague wrote this in R

 

He is using rgdal and raster libraries

 

Here is his code to process grc file

 

parse_grc <- function(file_name){

 

tab_grc <- raster(paste0(file_name, ".grc"))

grc_data <- as.data.frame(rasterToPoints(tab_grc))

coordinates(grc_data) <- ~x+y

crs(grc_data) <- crs(tab_grc)

grc_data <- spTransform(grc_data, CRS("+proj=longlat +datum=WGS84"))

site_info <- as.data.frame(tab_grc@data@attributes)

 

grc_data %>%

  as.tibble() %>%

  rename(id = contains(".")) %>%

  inner_join(site_info, c("id" = "ID")) %>%

  select(-id) %>%

  rename(sector = category) %>%

  mutate(flname = file_name) %>%

  separate(flname, into = c("type", "mkt", "band"),

           sep = "-", remove = TRUE) -> grc_df

 

return(grc_df)

}

 

In Python , I am using gdal , but Did not find the API’s like the once in R

 

Do you know any other libraries in Python that are close to rasters library in R 

 

Any direction is much appreciated

 

Thanks

-Venkat

 


_______________________________________________
US mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/us