Skip to main content
naming
Link
Vince
  • 20.3k
  • 16
  • 48
  • 65

Difference in crsCRS when reading with read_stars und read_ncdf

Source Link
Lenn
  • 1.4k
  • 8
  • 23

Difference in crs when reading with read_stars und read_ncdf

I have a NetCDF file that I would like to load into a stars object. The two functions st::read_stars and st::read_ncdf both load it in, but the data ends up in different locations when I plot it using mapview. I think I'm not getting something really basic here and just wanted to ask what the best way is to read NetCDF-files into a stars object. (The one with read_stars ends up in the right location). I'm using the exactly same path.

enter image description here

The description of two objects look like this:

Read with read_stars

stars object with 3 dimensions and 1 attribute
attribute(s):
 DAILYPCP_198001.nc [mm]
 Min.   :0.00           
 1st Qu.:0.00           
 Median :0.00           
 Mean   :0.07           
 3rd Qu.:0.00           
 Max.   :4.10           
 NA's   :194505         
dimension(s):
     from  to                                           offset                                       delta  refsys point values
x       1 641                                           605720                                         250 unnamed    NA   NULL
y       1 643                                          5220237                                        -250 unnamed    NA   NULL
DATE    1   1 3652.5 [(days since 1970-01-01 00:00:00 +00:00)] 1 [(days since 1970-01-01 00:00:00 +00:00)]      NA    NA   NULL
        
x    [x]
y    [y]
DATE    

And the one read with read_ncdf

stars object with 3 dimensions and 1 attribute
attribute(s):
 precipitation [mm]
 Min.   :0.00      
 1st Qu.:0.00      
 Median :0.00      
 Mean   :0.07      
 3rd Qu.:0.00      
 Max.   :4.10      
 NA's   :194505    
dimension(s):
     from  to         offset  delta                       refsys point values    
x       1 641         605720    250 +proj=tmerc +lat_0=0 +lon...    NA   NULL [x]
y       1 643        5059487    250 +proj=tmerc +lat_0=0 +lon...    NA   NULL [y]
DATE    1   1 1980-01-01 UTC 1 days                      POSIXct    NA   NULL