Trying to read a netCDF file from NOAA

I have been trying to read this netCDF file from NOAA

https://www.spc.noaa.gov/wcm/climo/sigtorn.nc

The link to it is on the page Storm Prediction Center Maps, Graphics, and Data Page

The file is odd in that the coordinates are moderately useless, the actual lat long values for the data-points are stored in layers in the file itself. When I read the file in using qgis, or terra, I end up with a grid in Africa instead of the U.S.

I can't figure out how to build a proper grid using the lat/long layers.

ncfname <- paste0(path, "Tornado/sigtorn.nc")
ncin <- nc_open(ncfname)
print(ncin)
File /home/ajackson/Dropbox/Rprojects/TexasDioceseCreationCare/Data/Tornado/sigtorn.nc (NC_FORMAT_64BIT):

 3 variables (excluding dimension variables):
    double sigtorn[lats,lons]   
        _FillValue: NaN
    double lon[y,x]   
        _FillValue: NaN
    double lat[y,x]   
        _FillValue: NaN

 4 dimensions:
    lons  Size:45 (no dimvar)
    lats  Size:70 (no dimvar)
    x  Size:45 (no dimvar)
    y  Size:70 (no dimvar)

3 global attributes:
    map_proj: +proj=lcc +lat_0=25 +lon_0=265 +lat_1=25 +lat_2=25 +x_0=0 +y_0=0 +R=6371200 +units=m +no_defs
    description: Mean Number of Significant Tornado Days per Decade within 25 Miles of a Point between 1986 and 2015
    coordinates: lon lat

terra::rast(paste0(path, "Tornado/sigtorn.nc"))
[1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named lats BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
[1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named lons BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
class : SpatRaster
dimensions : 45, 70, 1 (nrow, ncol, nlyr)
resolution : 1, 1 (x, y)
extent : 0.5, 70.5, 0.5, 45.5 (xmin, xmax, ymin, ymax)
coord. ref. : lon/lat WGS 84
source : sigtorn.nc:sigtorn
varname : sigtorn
name : sigtorn
min value : 0.000000
max value : 4.051028


foobar <- raster::stack(ncfname)
[1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named lats BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
[1] "vobjtovarid4: **** WARNING **** I was asked to get a varid for dimension named lons BUT this dimension HAS NO DIMVAR! Code will probably fail at this point"
Warning message:
In .varName(nc, varname, warn = warn) : varname used is: sigtorn
If that is not correct, you can set it to one of: sigtorn, lon, lat

raster::plot(foobar)

image

Note that the lat/long for Florida is about 28, -80 and on the map it looks like 5, 55

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.