Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not a valid CDM file #33

Open
gustavost26 opened this issue Dec 27, 2018 · 4 comments
Open

Not a valid CDM file #33

gustavost26 opened this issue Dec 27, 2018 · 4 comments

Comments

@gustavost26
Copy link

I downloaded the following gfs.t00z.pgrb2.1p00.f000 config file shown in github.

But when executing the following command:
sh grib2json -d -n -o current-wind-surface-level-gfs-1.0.json gfs.t00z.pgrb2.1p00.f000

And presenting the following error:

java.io.IOException: java.io.IOException: Cant read gfs.t00z.pgrb2.1p00.f000: not a valid CDM file.
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:425)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:392)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:379)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:367)
at net.nullschool.grib2json.Grib2Json.write(Grib2Json.java:114)
at net.nullschool.grib2json.Launcher.main(Launcher.java:75)
Caused by: java.io.IOException: Cant read gfs.t00z.pgrb2.1p00.f000: not a valid CDM file.
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:803)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:422)
... 5 more

I noticed that the file I downloaded according to the github tutorial does not have the extension .grb2

How do I download a file with this extension for possible conversion to json?

Sources:
https://github.com/cambecc/earth
https://github.com/cambecc/grib2json

@gustavost26
Copy link
Author

@DeZhao-Zhang
Copy link

have you solve this problem?I have the same problem

@gustavost26
Copy link
Author

gustavost26 commented Apr 10, 2019

@Rhettydl
If you are having this error, it is quite possible that you are trying to convert an invalid file.

Download a valid file through this site:
https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_1p00.pl

@denx-b
Copy link

denx-b commented May 29, 2019

The error "Not a valid CDM file" occurs when a square is selected incorrectly. You can get the minimal possible and correct square as follows:

lon = 54.941036
lat = 20.153401

if (lon < 0):
    lon += 360

leftLongitude = round(lon / 0.5) * 0.5
rightLongitude = leftLongitude + 0.25
topLatitude = round(lat / 0.5) * 0.5
bottomLatitude = topLatitude - 0.25

print(leftLongitude, rightLongitude)
print(topLatitude, bottomLatitude)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants