0
votes

I'm downloading a netCDF dataset for contour plotting and analysis but cannot get the data projection quite right. The file says that it is a Lambert Conformal Projection and provides the lat/lon min/max:

geospatial_lat_min: 17.5812268306
geospatial_lat_max: 55.5349606426
geospatial_lon_min: -140.027321405
geospatial_lon_max: -57.2098720419

However, the x and y data points are a bit confusing (y shown below for reference):

print data.variables['y'][:]
[ -4.26348724e+02  -4.06030731e+02  -3.85712738e+02  -3.65394714e+02
  -3.45076721e+02  -3.24758728e+02  -3.04440735e+02  -2.84122711e+02
  -2.63804718e+02  -2.43486725e+02  -2.23168716e+02  -2.02850723e+02
  -1.82532715e+02  -1.62214722e+02  -1.41896713e+02  -1.21578720e+02
  -1.01260719e+02  -8.09427185e+01  -6.06247177e+01  -4.03067169e+01
  -1.99887161e+01   3.29285234e-01   2.06472855e+01   4.09652863e+01
   6.12832870e+01   8.16012878e+01   1.01919289e+02   1.22237289e+02
   1.42555298e+02   1.62873291e+02   1.83191299e+02   2.03509293e+02
   2.23827301e+02   2.44145294e+02   2.64463287e+02   2.84781311e+02
   3.05099304e+02   3.25417297e+02   3.45735291e+02   3.66053314e+02
   3.86371307e+02   4.06689301e+02   4.27007294e+02   4.47325317e+02
   4.67643311e+02   4.87961304e+02   5.08279297e+02   5.28597290e+02
   5.48915283e+02   5.69233337e+02   5.89551331e+02   6.09869324e+02
   6.30187317e+02   6.50505310e+02   6.70823303e+02   6.91141296e+02
   7.11459290e+02   7.31777344e+02   7.52095337e+02   7.72413330e+02
   7.92731323e+02   8.13049316e+02   8.33367310e+02   8.53685303e+02
   8.74003296e+02   8.94321350e+02   9.14639343e+02   9.34957336e+02
   9.55275330e+02   9.75593323e+02   9.95911316e+02   1.01622931e+03
   1.03654736e+03   1.05686536e+03   1.07718335e+03   1.09750134e+03
   1.11781934e+03   1.13813733e+03   1.15845532e+03   1.17877332e+03
   1.19909131e+03   1.21940930e+03   1.23972729e+03   1.26004529e+03
   1.28036328e+03   1.30068140e+03   1.32099939e+03   1.34131738e+03
   1.36163538e+03   1.38195337e+03   1.40227136e+03   1.42258936e+03
   1.44290735e+03   1.46322534e+03   1.48354333e+03   1.50386133e+03
   1.52417932e+03   1.54449731e+03   1.56481531e+03   1.58513330e+03
   1.60545129e+03   1.62576941e+03   1.64608740e+03   1.66640540e+03
   1.68672339e+03   1.70704138e+03   1.72735938e+03   1.74767737e+03
   1.76799536e+03   1.78831335e+03   1.80863135e+03   1.82894934e+03
   1.84926733e+03   1.86958533e+03   1.88990332e+03   1.91022131e+03
   1.93053931e+03   1.95085742e+03   1.97117542e+03   1.99149341e+03
   2.01181140e+03   2.03212939e+03   2.05244727e+03   2.07276538e+03
   2.09308325e+03   2.11340137e+03   2.13371948e+03   2.15403735e+03
   2.17435547e+03   2.19467334e+03   2.21499146e+03   2.23530933e+03
   2.25562744e+03   2.27594531e+03   2.29626343e+03   2.31658130e+03
   2.33689941e+03   2.35721729e+03   2.37753540e+03   2.39785327e+03
   2.41817139e+03   2.43848950e+03   2.45880737e+03   2.47912549e+03
   2.49944336e+03   2.51976147e+03   2.54007935e+03   2.56039746e+03
   2.58071533e+03   2.60103345e+03   2.62135132e+03   2.64166943e+03
   2.66198730e+03   2.68230542e+03   2.70262329e+03   2.72294141e+03
   2.74325928e+03   2.76357739e+03   2.78389551e+03   2.80421338e+03
   2.82453149e+03   2.84484937e+03   2.86516748e+03   2.88548535e+03
   2.90580347e+03   2.92612134e+03   2.94643945e+03   2.96675732e+03
   2.98707544e+03   3.00739331e+03   3.02771143e+03   3.04802930e+03
   3.06834741e+03   3.08866553e+03   3.10898340e+03   3.12930151e+03
   3.14961938e+03   3.16993750e+03   3.19025537e+03   3.21057349e+03
   3.23089136e+03   3.25120947e+03   3.27152734e+03   3.29184546e+03
   3.31216333e+03   3.33248145e+03   3.35279932e+03   3.37311743e+03
   3.39343530e+03   3.41375342e+03   3.43407153e+03   3.45438940e+03
   3.47470752e+03   3.49502539e+03   3.51534351e+03   3.53566138e+03
   3.55597949e+03   3.57629736e+03   3.59661548e+03   3.61693335e+03
   3.63725146e+03   3.65756934e+03   3.67788745e+03   3.69820532e+03
   3.71852344e+03   3.73884155e+03   3.75915942e+03   3.77947754e+03
   3.79979541e+03   3.82011353e+03   3.84043140e+03   3.86074951e+03
   3.88106738e+03   3.90138550e+03   3.92170337e+03   3.94202148e+03
   3.96233936e+03]

Edit: The x/y projected coordinates are defined to have units of km.

I have the x and y lengths (301 and 217, respectively) and feel like I could define the lat and lon values manually or convert the projection using PyProj. However, I'm a bit lost on where to start.

My initial thought was to use the min lat and lon and the average difference between grid points:

for i in range(0,len(lat_vals)):
    lat_vals[i] = 16.28100013732909+0.18297297297*i

for j in range(0,len(lon_vals)):
    lon_vals[j] = -139.9440104734173+0.27634406361*j

But, that was before I remembered that longitude change will not be constant with latitude.

Thanks for your help!

1

1 Answers

1
votes

For anyone who is using siphon and TDSCatalog to grab data via the THREDDS server at thredds.ucar.edu (as I was), you can use the .add_lonlat('true') option on your query to get lat/lon coordinates. That solved it!