Eratos Projection Handling
Get Timeseries at Points Automated Projection Handling
The Get Timeseries at Points function automatically handles the projection through its design.
However, both Get Geospatial Grid at Times as Array and Get 3D Subset as Array do not.
Manual Projection Handling
WGS84 projection is the Eratos standard projection.
When wanting to pull a grid from a non-WGS84 projection dataset, the bottom left and top right points must be defined in the dataset's projection.
Eratos stores the projection metadata in the dataset metadata.
An example of how to access that can be seen below:
#Eratos adapter and credentials system
from eratos.creds import AccessTokenCreds
from eratos.adapter import Adapter
import pandas as pd
from tabulate import tabulate
from getpass import getpass
import pprint
eratos_id = getpass('Enter the eratos key id:')
eratos_secret = getpass('Enter the eratos secret:')
ecreds = AccessTokenCreds(
eratos_id,
eratos_secret
)
eadapter = Adapter(ecreds)
climate_dataset_block = eadapter.Resource(ern='ern:e-pn.io:resource:fcdi.block.aus-22.rcp85.ncc-noresm1-m.r1i1p1.ictp-regcm4-7.v0.day.pr')
print('Climate dataset block metadata: Describes the Dataset block:')
#pprint.pprint(climate_dataset_block.props())
print('Extracting primary')
pprint.pprint(climate_dataset_block.prop('primary'))
climate_dataset_metadata = eadapter.Resource(ern=climate_dataset_block.prop('primary'))
print('\n Climate dataset resource metadata: Describes the Dataset Resource:')
#pprint.pprint(climate_dataset_metadata.props())
dataset_props = climate_dataset_metadata.props()
print(dataset_props['grid']['geo'])
print(dataset_props['grid']['geo']['proj'])
from pyproj import CRS
from pyproj import Transformer
fromCRS = CRS.from_proj4("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
toCRS = CRS.from_proj4(dataset_props['grid']['geo']['proj'])
Updated 8 days ago