harphub / harpIO

IO functions for HARP
https://harphub.github.io/harpIO/
Other
6 stars 16 forks source link

How to read and write msl pressure in to SQLite ? #27

Closed meteorolog90 closed 3 years ago

meteorolog90 commented 3 years ago

Code:

library(tidyverse)
library(here)
library(harpIO)
library(harpVis)
library(harpPoint)

stanice <- read.csv("~/HARP/STANICE.csv")
stanice <- as.data.frame(stanice)

start=2020071300
end=2020071900

Aladin_msl <- read_forecast(

start_date = start,
end_date   = end,
fcst_model  = "Aladin_45",
parameter="Pmsl",
lead_time= seq(0,48,3),
by= "6h",
file_path  = "/data/nwp/oper/grib/shmu/",
file_format="grib",
file_template ="{YYYY}-{MM}-{DD}_{HH}/MSLPRESSURE_{LDT2}.grb",
transformation="interpolate",
transformation_opts=interpolate_opts(
stations=stanice, 
clim_file ="/data/nwp/oper/grib/shmu/2020-07-13_00/SURFGEOPOTENTIEL_00.grb"),

output_file_opts=sqlite_opts(path="/work/users/ext005/sql/forecast"),
return_data=TRUE

)

Error:

Reading /data/nwp/oper/grib/shmu/2020-07-13_00/SURFGEOPOTENTIEL_00.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_00.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_03.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_06.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_09.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_12.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_15.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_18.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_21.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_24.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_27.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_30.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_33.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_36.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_39.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_42.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_45.grb
Reading /data/nwp/oper/grib/shmu//2020-07-13_00/MSLPRESSURE_48.grb
Error: Unknown vertical coordinate: unknown

Grib files: gribs.zip

packageVersion("harpIO") [1] '0.0.0.9160'

Can you give us some examples how to read grib files, because i have a lot of problem with it ? Best regards, Martin

andrew-MET commented 3 years ago

Unfortunately I don't have many grib files to work with as we don't really use them where I am and am thus far from an expert. I was kind of expecting this issue as I knew the situation existed, but had no data to test with, which is why it threw that error rather than crash uninformatively. Now with some data to work on it was easily fixed.

Let us know if you have further issues with grib files, as there are probably quite a number of features / differences that we haven't encountered in our very limited test data.

Incidentally, you only need to supply a clim file for 2m temperature, and in general you don't need to explicitly pass the file format as the function should be able to work it out.

meteorolog90 commented 3 years ago

Thanks, it works now. I will test again all grib files, if the problem occurs again, i will make a list of problems that have arisen.