Skip to main content
Question

NetCDF Rotated Coordinates


roberto
Contributor
Forum|alt.badge.img+6

Hello,

I’m trying to work with Cordex NetCDF files (Europe).

The main, challenging, issue I’m facing is the rotation of coordinates used by Cordex.

Googling and trying for some days I found a Proj4 string that seems to work. At least it works in a python caller with pyproj lib. 

 

crsROT = CRS("+proj=ob_tran +o_proj=longlat +o_lon_p=-162 +o_lat_p=39.25 +lon_0=180 +to_meter=0.01745329")

crs4326 = CRS('EPSG:4326')

x=feature.getCoordinate(0)

transformer = Transformer.from_crs(crs4326, crsROT)

p1 = transformer.transform(x[1], x[0])

 

The process is understandably very slow. Some improvement can be applied working with list of coordinates, but I hope FME can provide some better standard solutions.

I put the same Proj4 string in a PROJReprojector. Also considering that working with raster and then to clip the desired region is faster. The parameters I’m using are in the attached image.

Unfortunately, the results are completely different. Both applying the transformer to vector or Raster. For sure I’m using the transformer in the wrong way.

Attached also the correct and wrong representation (in color the correct one).

Suggestions?

TIA.

Roberto

2 replies

roberto
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • June 28, 2021

Hello,

looking better to the python code and the FME transformer parameters, the solution was to switch between source and destination. In fact the working python transform is "Transformer.from_crs(crs4326, crsROT). So, the first parameter is in reality the destination coordinates and the second the source. Maybe a better reading of the documentation could help understanding this. Following the same rule in the ProjReprojector parameters, now the result is fine. Attached both parameters and final result. Does someone know the rationale of this "from-to" syntax?

In any case, I will go ahead with the extraction of data that I supposed, before to face the reprojection stuff, to be the complex one.

Roberto


roberto
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • June 28, 2021
roberto wrote:

Hello,

looking better to the python code and the FME transformer parameters, the solution was to switch between source and destination. In fact the working python transform is "Transformer.from_crs(crs4326, crsROT). So, the first parameter is in reality the destination coordinates and the second the source. Maybe a better reading of the documentation could help understanding this. Following the same rule in the ProjReprojector parameters, now the result is fine. Attached both parameters and final result. Does someone know the rationale of this "from-to" syntax?

In any case, I will go ahead with the extraction of data that I supposed, before to face the reprojection stuff, to be the complex one.

Roberto

And the result (not able t add two attachment to the same reply)

R.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings