atmoschem / eixport

Export Emissions to Atmospheric Models
https://atmoschem.github.io/eixport/
Other
27 stars 10 forks source link

fixed error of incorrect number of dimensions #65

Closed bakamotokatas closed 3 years ago

bakamotokatas commented 3 years ago

I got the below error when I used the wrf_raster function.

Error in inNCLon[, ncol(inNCLon):1] : incorrect number of dimensions

I fixed the error, by removing commas.

codecov[bot] commented 3 years ago

Codecov Report

Merging #65 (7591212) into master (a04708f) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #65   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           18        18           
  Lines          774       774           
=========================================
  Hits           774       774           
Impacted Files Coverage Δ
R/wrf_raster.R 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a04708f...7591212. Read the comment docs.

ibarraespinosa commented 3 years ago

Oi @Schuch666, tu pode dar uma conferida por favor.

Many thanks @bakamotokatas, we will check this.

Schuch666 commented 3 years ago

Hello @bakamotokatas

The wrf_raster expect to read a matrix/array with dimension 2 from a wrf file for latitude and for longitude. In case you are opening a different file or (for some reason) a wrf file with different dimmention of lat / lon it is better not to change for all cases.

Do you have a code/data that generate this error? I can incorporate these changes for your case

Thanks, Daniel

Schuch666 commented 3 years ago

@bakamotokatas , you can open a new issue (marking me so that I receive the notifications) or use this session (marking me so that I receive the notifications)

Schuch666 commented 3 years ago

Hi @bakamotokatas check the last version of wrf_raster

bakamotokatas commented 3 years ago

Sorry for not answering earlier @Schuch666 , I was so busy at the time that I forgot. I checked the final version of wrf_raster and it works fine this time.

But there is another problem that happened last time and I see it is continuing now. Maybe I should also create a new issue for this. wrf_raster is getting the projection of the wrf wrong (seems to reverse longitude and latitude). I think it's probably because my proj or gdal libraries are more up to date. You can see the sample image below. This image actually needs to sit on Turkey.

image

I had created a similar issue for a similar GIS project. I think it has the same problem. They solved according to this link. But I couldn't make any changes in the code for a solution because I don't have much idea about it.

My example code;

library(raster)
library(ncdf4)
library(EmissV)
library(eixport)
library(leaflet)
library(htmlwidgets)
raster<-wrf_raster(file = "/home/bakamotokatas/Build_WRF/WRF-4.3-ARW/run/wrfout_d01_2020-02-16_00:00:00",name = "HGT")
plot(raster$HGT_2020.02.16_00.00.00)
raster<-projectRaster(raster, crs='+proj=longlat +datum=WGS84')
pal <- colorNumeric(c("forestgreen", "yellow", "red"), values(raster$HGT_2020.02.16_00.00.00),na.color = "transparent")
leaflet() %>%
  addTiles() %>%
  addRasterImage(raster$HGT_2020.02.16_00.00.00, colors = pal, opacity = 0.7) %>%
  addLegend(pal = pal, 
            values = values(raster$HGT_2020.02.16_00.00.00),
            title = "Height (m)")