-
Notifications
You must be signed in to change notification settings - Fork 0
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
Issues on final product [EMODNETBIO-181] #1
Comments
New iteration on 2024-08-27. Some of the issues seem solved, thanks @wstolte ! $ ncdump -h foo.nc
netcdf foo {
dimensions:
lon = 4361 ;
lat = 4209 ;
aphiaid = 4 ;
string80 = 80 ;
variables:
double lon(lon) ;
lon:units = "degrees_east" ;
lon:standard_name = "longitude" ;
lon:long_name = "Longitude" ;
double lat(lat) ;
lat:units = "degrees_north" ;
lat:standard_name = "latitude" ;
lat:long_name = "Latitude" ;
int aphiaid(aphiaid) ;
aphiaid:long_name = "Life Science Identifier - World Register of Marine Species" ;
char taxon_name(aphiaid, string80) ;
taxon_name:standard_name = "biological_taxon_name" ;
taxon_name:long_name = "Scientific name of the taxa" ;
char taxon_lsid(aphiaid, string80) ;
taxon_lsid:standard_name = "biological_taxon_lsid" ;
taxon_lsid:long_name = "Life Science Identifier - World Register of Marine Species" ;
char crs ;
crs:long_name = "Coordinate Reference System" ;
crs:geographic_crs_name = "WGS 84" ;
crs:grid_mapping_name = "latitude_longitude" ;
crs:reference_ellipsoid_name = "WGS 84" ;
crs:horizontal_datum_name = "WGS 84" ;
crs:prime_meridian_name = "Greenwich" ;
crs:longitude_of_prime_meridian = 0. ;
crs:semi_major_axis = 6378137. ;
crs:semi_minor_axis = 6356752.31424518 ;
crs:inverse_flattening = 298.257223563 ;
crs:spatial_ref = "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563]],PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AXIS[\"Latitude\",NORTH],AXIS[\"Longitude\",EAST],AUTHORITY[\"EPSG\",\"4326\"]]" ;
crs:GeoTransform = "-180 0.08333333333333333 0 90 0 -0.08333333333333333 " ;
double habitat_suitability(aphiaid, lat, lon) ;
habitat_suitability:_FillValue = -99999. ;
habitat_suitability:long_name = "Modelled habitat suitability for a species." ;
}
Indeed I can see that the data is not correctly plot (this case in panoply) I have faced this before and fixed by changing the order of the data, not the latitude/longitude. Lat and Lon must be in ascendent order. You read the data as a matrix and via transpose library(terra)
array <- terra::rast("foo.nc") |>
terra::as.array()
matrix <- array[, , 1] |>
terra::as.matrix()
dim(matrix)
# Transpose dimensions
matrix <- t(matrix)
# dim(matrix)
# Reverse order of lon
matrix <- apply(matrix, 1, rev)
# dim(matrix)
# Traspose one more time
matrix <- t(matrix)
raster <- terra::rast(matrix)
crs(raster) <- "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100 +ellps=WGS84"
plot(raster)
|
One more version sent on 2024-08-27. Product looking good!
There are only some details to be tackled:
|
Hi @wstolte,
Here some issues Im finding in the file with the final product. Writing here for documentation.
Notice how the values of the variables present some aberrations.
e.g. I would not expect such high max and low min values of latitude, longitude or habitat suitability.
Longitude, latitude and aphiaid must be in ascendant order. Longitude must not have duplicated values.
The aphiaIDs in the file do not exist. The taxon_name and taxon_lsid seem corrupt.
Could you have a look? Maybe something went wrong when creating the file?
Created on 2024-08-09 with reprex v2.1.0
Session info
The text was updated successfully, but these errors were encountered: