Comments (5)
Sorry to hear this new issue, I can't reproduce this problem but it doesn't seem to be related to projection but in the order of some arguments passed to the project function that is internally imported from the rgdal
package. In next versions of the eixport
this process will be performed using functions from sp
/sf
packages.
As a workaround, I added an argument that switches the lat
for lon
, you will need to set reverse = TRUE
:
...
raster<-wrf_raster(file = "/home/bakamotokatas/Build_WRF/WRF-4.3-ARW/run/wrfout_d01_2020-02-16_00:00:00",name = "HGT",reverse = T)
...
Let me know if it works for you
from eixport.
Thanks for the workaround @Schuch666. Actually, I tried swapping y with x too. But it still doesn't fit the map like in the picture.
I tried to play with this part, without reversing y and x.
from
xmn <- projcoords[1,1] - dx/2 # Left border
ymx <- projcoords[1,2] + dy/2 # upper border
to
xmn <- projcoords[1, 2] - dx/2
ymx <- projcoords[1, 1] + dy/2
it approached the area where it should be, but still further east and south of the place where it should be; as it is seen in the image.
I tried adding dx and dy with different combinations, but I still couldn't fit.
additionally, the code gives this warning while drawing.
Warning messages:
1: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
Discarded ellps WGS 84 in Proj4 definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs
2: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
Discarded datum World Geodetic System 1984 in Proj4 definition
3: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
Discarded ellps WGS 84 in Proj4 definition: +proj=merc +a=6378137 +b=6378137 +lat_ts=0 +lon_0=0 +x_0=0 +y_0=0 +k=1 +units=m +nadgrids=@null +wktext +no_defs +type=crs
4: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) :
Discarded datum World Geodetic System 1984 in Proj4 definition
from eixport.
After some testing I changed the wrf_raster
function to use both rgdal
and sf
to do this transformation (rgdal
will be removed in future versions), In the following example there is the use of this function with rgdal
and using sf
(the commented parts are only needed to plot the map).
library(eixport)
library(raster)
# library(maps)
# library(hackWRF)
file = paste(system.file("extdata", package = "eixport"),"/wrfinput_d01", sep="")
# mapa <- raster::shapefile(paste(system.file("extdata", package = "hackWRF"),"/BR_estates.shp",sep=""),verbose=F)
Rrgdal <- wrf_raster(file,'XLAT',latlon = T)
plot(Rrgdal, legend.shrink = 0.98,legend.width = 3, main = 'XLAT rgdal::project')
# map(mapa, add=TRUE, lwd=1, interior = FALSE, col = "black")
Rsf <- wrf_raster(file,'XLAT',latlon = T,use_sf = T)
plot(Rsf, legend.shrink = 0.98,legend.width = 3, main = 'XLAT sf::st_transform')
# map(mapa, add=TRUE, lwd=1, interior = FALSE, col = "black")
these warnings related to projection are not a problem in general.
Let me know if this code is working and if this changes solves the problem, if it doesn't, I'll need more data to reproduce the problem.
from eixport.
Hi @Schuch666, really sorry for wasting your time. It's been my fault from the start. I didn't realize why the comma was there because I didn't examine it in detail. Now, when I examined it in detail, I realized it and you only need to correct the place below.
from
if (length(dim(inNCLon)) == 3) {
x <- as.vector(inNCLon[ncol(inNCLon):1])
y <- as.vector(inNCLat[ncol(inNCLat):1])
}
to
if (length(dim(inNCLon)) == 3) {
x <- as.vector(inNCLon[, ncol(inNCLon):1,])
y <- as.vector(inNCLat[, ncol(inNCLat):1,])
}
now it works. Because there was a similar problem in another program, I thought its the same.
from eixport.
No problem, there is no time wasted, the change from rgdal
to sf
was a pending task and since it is not possible to test all possibilities for the wrf_raster
function all the input is welcome.
This last version of the wrf_raster
contain some changes including your suggestion, an option to project the output to latlon, use_sf and a fix in layer name for 2d variables.
Let us know if you find ant new issues
from eixport.
Related Issues (20)
- units problem HOT 4
- add summary to ncpath
- add to_citychem
- add to_camx
- Error on wrf_meta HOT 1
- add function to easily create NetCDF from bricks
- Improve wrf_input chemistry condition with ML and other approaches
- add function to support citychem
- can we control units in wrf_create? HOT 1
- write article to plot wrf outputs
- add wrf_rh HOT 3
- set NA as 0 in wrf_put HOT 4
- add chemistry in boundary and initial conditions HOT 3
- add to_*
- CRAN HOT 7
- add chimere_create HOT 1
- Please remove dependencies on **rgdal**, **rgeos**, and/or **maptools** HOT 8
- Error in wrf_raster in file without Times variable
- Wrong Molar Masses HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eixport.