Closed pavelber closed 4 years ago
Hi @pavelber, I'm not quite sure what you mean by "when record is constant". Could you please clarify? Also, it would probably speed things up if you could send the GRIB file and explain what you're trying to do. Cheers!
Small code in Kotlin, using attached file
import mt.edu.um.cf2.jgribx.GribFile
import mt.edu.um.cf2.jgribx.grib1.Grib1Record
object Test1 {
@JvmStatic
fun main(args: Array<String>) {
val file = GribFile("C:\\temp\\C3_2019112600_CLCL.grb")
val record = file.records.filter { r-> (r as Grib1Record).bds.isConstant }.first()
println(record.forecastTime.toInstant())
println(record.getValue(31.93, 34.7))
}
}
Hi @pavelber,
Just to let you know that I've managed to reproduce the issue. Will keep you posted. Thanks for finding these issues!
Thank you!
Found an issue in how the BDS is handled. Made a fix in e2f86fde57368a797fb41a461bdfb4b77e5cf687
The exception should be gone now, but I see that all values for your sample code is zero, since all records have a constant-valued BDS. Is this what you were expecting?
Yes, exactly, believe or not but now we have hot weather w/o clouds :)
Will try the fix now.
Just checked the coords ... Gan Raveh Regional Council, Israel? Looks like a great place to be... :)
Looks good, thank you! Fixed!
It is good place now, but terrible place in summer :)
Exception in thread "main" java.lang.NullPointerException at mt.edu.um.cf2.jgribx.grib1.Grib1RecordBDS.getValue(Grib1RecordBDS.java:276) at mt.edu.um.cf2.jgribx.grib1.Grib1Record.getValue(Grib1Record.java:296)