abby-baskind / seniorthesis

0 stars 2 forks source link

dear NorCPM1...you just ain't it #8

Open abby-baskind opened 3 years ago

abby-baskind commented 3 years ago

mostly just leaving this as a reminder to myself, but if you're not me and you're here and you have thoughts i'd appreciate it

so despite using the regridded data (gr) and despite all the other models being unproblematic, NorCPM1 just wants to continue using indices for x and y instead of coordinates for talk, thetao, and so (but not dissic bc it doesn't have dissic)

For instance, from thetao... y = array([ 1, 2, 3, ..., 382, 383, 384], dtype=int32) and x = array([ 1, 2, 3, ..., 318, 319, 320], dtype=int32). The same thing happens for the other variables.

Since the meridional Pacific sections look reasonable (except for the x-axis), the indices clearly scale with latitude (as expected).

Screen Shot 2021-07-06 at 5 57 01 PM Screen Shot 2021-07-06 at 5 57 09 PM Screen Shot 2021-07-06 at 5 57 22 PM

But because x and y are indices, x and y don't really translate well onto polar stereographic projections

Screen Shot 2021-07-06 at 5 57 46 PM Screen Shot 2021-07-06 at 5 58 00 PM Screen Shot 2021-07-06 at 5 58 13 PM

There MUST be a way to covert these indices to coordinates. That's going to require I know how the coordinates scale with index (i.e. 1 index = how much latitude/longitude). It also will require I know how to change a fundamental attribute of the dataarray/xarray (idk what it is, also need to figure that out). There also might be a solution through preprocessing so I should check that too

gmacgilchrist commented 3 years ago

Hi @abby-baskind a couple of things:

  1. You can always replace indices with more appropriate coordinates using the .assign_coords function. In that function, you can specify a dictionary that maps the dimension to an array that you wish to use as coordinates. So, for example, if longitudearray is an array giving the correct longitudes: ds.assign_coords({'x':longitudearray})
  2. For the polar stereographic projections, how does it look if you use the gridded latitude and longitude as opposed to the dimensional information? This is just like the subsetting problem (i.e. where you were using the .where command) - you want to orient the figure based on the actual values of the latitude and longitude, whereas the dimensional information is indicative only. Make sense?