Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Converting Projection of WRF Output file

ihaseeburrehman

New member
Dear All
I am trying to convert LCC projection to UTM projection using python. below is my code

# Define the source (Lambert Conformal) and destination (UTM) projections
lambert = pyproj.Proj(proj='lcc',lat_0 = 49.8, lon_0=6.0, lat_1=6.1, lat_2=12.2, a=6370000, b=6370000)
utm = pyproj.Proj(proj='utm', zone=32, northern=True, datum='WGS84')
# Create a transformer object
transformer = Transformer.from_proj(lambert, utm)

# Get the XLAT and XLON arrays
XLAT_variable = [s for s in subdatasets if "XLAT" in s[0]][0]
XLAT_dataset = gdal.Open(XLAT_variable[0])
XLAT_data = XLAT_dataset.ReadAsArray()

XLONG_variable = [s for s in subdatasets if "XLONG" in s[0]][0]
XLONG_dataset = gdal.Open(XLONG_variable[0])
XLONG_data = XLONG_dataset.ReadAsArray()

# Perform the transformation
x, y = transformer.transform(XLAT_data, XLONG_data)

But it is plotting data somewhere else. is it normal ? or WRF projection can not be converted to UTM projection. If there is a way what is that ?

Thanks for your help
 
Top