-
Notifications
You must be signed in to change notification settings - Fork 53
Adds SSS model vs obs capability #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,6 +133,35 @@ def ocn_modelvsobs(config, field, streamMap=None, variableMap=None): | |
fileOutLabel = "sstHADOI" | ||
unitsLabel = r'$^o$C' | ||
|
||
elif field == 'sss': | ||
|
||
selvals = {'nVertLevels': 0} | ||
|
||
obs_filename = "{}/Aquarius_V3_SSS_Monthly.nc".format(obsdir) | ||
dsData = xr.open_mfdataset(obs_filename) | ||
|
||
time_start = datetime.datetime(2011, 8, 1) | ||
time_end = datetime.datetime(2014, 12, 31) | ||
|
||
ds_tslice = dsData.sel(time=slice(time_start, time_end)) | ||
|
||
# The following line converts from DASK to numpy to supress an odd | ||
# warning that doesn't influence the figure output | ||
ds_tslice.SSS.values | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eventually we will be able to remove this line, most likely. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be good to submit an xarray / dask bug report if we could get a simple xarray or dask - only reproducible manifestation of this error if possible. However, this may be time consuming and not worth it, at least in the short-term. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @pwolfram not sure if this is helpful information, but I can also suppress this warning if I open the SSS observations with xr.open_dataset instead of xr.open_mfdataset. It's curious that the multiple file version of open throws a warning for SSS, but not for SST or MLD. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is some type of dask-xarray integration error. Getting to the bottom of it will potentially be tricky. I'd say pass on this for now. |
||
|
||
monthly_clim_data = ds_tslice.groupby('time.month').mean('time') | ||
|
||
# Rename the observation data for code compactness | ||
dsData = monthly_clim_data.transpose('month', 'lon', 'lat') | ||
obsFieldName = 'SSS' | ||
|
||
# Set appropriate figure labels for SSS | ||
preIndustrial_txt = "2011-2014" | ||
|
||
obsTitleLabel = "Observations (Aquarius, {})".format(preIndustrial_txt) | ||
fileOutLabel = 'sssAquarius' | ||
unitsLabel = 'PSU' | ||
|
||
ds = xr.open_mfdataset( | ||
infiles, | ||
preprocess=lambda x: preprocess_mpas(x, yearoffset=yr_offset, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
oceanVariableMap['avgLayerTemperature'] = \ | ||
['time_avg_avgValueWithinOceanLayerRegion_avgLayerTemperature', | ||
'time_avg_avgValueWithinOceanLayerRegion_avgLayerTemperature_1', | ||
'timeMonthly_avg_avgValueWithinOceanLayerRegion_avgLayerTemperature'] | ||
'timeMonthly_avg_avgValueWithinOceanLayerRegion_avgLayerTemperature'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto for me too! |
||
oceanVariableMap['sumLayerMaskValue'] = \ | ||
['time_avg_avgValueWithinOceanLayerRegion_sumLayerMaskValue', | ||
'time_avg_avgValueWithinOceanLayerRegion_sumLayerMaskValue_1', | ||
|
@@ -44,3 +44,8 @@ | |
['time_avg_activeTracers_temperature', | ||
'time_avg_activeTracers_temperature_1', | ||
'timeMonthly_avg_activeTracers_temperature'] | ||
|
||
oceanVariableMap['sss'] = \ | ||
['time_avg_activeTracers_salinity', | ||
'time_avg_activeTracers_salinity_1', | ||
'timeMonthly_avg_activeTracers_salinity'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vanroekel, do we really need all the commented lines above? The same is true below too...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My recommendation would be to keep this file as clean as possible by only having comments as absolutely necessary to help avoid confusion in the long term.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pwolfram and @vanroekel, I agree that I don't love having these commented out options in the default config file. Ideally comments should be for clarification rather than alternative options, and instead we would have alternative config files or scripts for modifying config files or something along those lines for changing color maps, etc.
But I also know that this convention has been used for other modelvsobs entries so it's probably not something to address in this specific case but rather to clean up more broadly later on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me.