-
Notifications
You must be signed in to change notification settings - Fork 1
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
Writing adjusted variables and flags #11
Comments
This issue (along with #12) are operational priorities following today's release. |
Note for changing SCIENTIFIC_CALIB type parameters, N_CALIB is the dimension that will need to be adjusted. This will take some file I/O hoop jumping through for the following variables: for v in nc.variables.keys():
if 'N_CALIB' in nc.variables[v].dimensions:
print(v)
Out:
PARAMETER
SCIENTIFIC_CALIB_EQUATION
SCIENTIFIC_CALIB_COEFFICIENT
SCIENTIFIC_CALIB_COMMENT
SCIENTIFIC_CALIB_DATE |
netCDF files are, by design, difficult to alter. For the above variables I'll be following the example in this post to update them: https://stackoverflow.com/questions/15141563/python-netcdf-making-a-copy-of-all-variables-and-attributes-but-one I will also have to exclude the N_CALIB dimension to iterate it. |
Implemented the above in 007ba5a. The basic work flow will look like:
|
Just did some testing and first step appears to be working well. Worth noting that if you are going to exclude a dimension, you must also exclude any variables that have that dimension. This could be done automatically quite easily, but I am going to leave it without doing that so that the user is required to be specific in what they are doing. Else, you could delete a variable you don't realize uses that dimension. I will however add in some good/informative output for situations when that does occur (i.e. strong error handling if a variable uses a dimension that no longer exists). |
Function to append new variable was also written in f35d817. In practice, will likely delete a variable and dimension using the above function, iterate the dimension (likely N_CALIB += 1) and add to an existing nc variable. Once testing is done on this function, will consider this issue closed. The next step will be to check the altered files against the Argo file checker, will create separate issue for that. |
For reference, as adding to SCIENTIFIC_CALIB_<> will be the main purpose of this function, standard comments via Henry Bittig at ADMT21:
(a): 1st Generation: Electrochemical SBE43; 2nd Generation: Batch-Foil calibrated Optodes; 3rd Generation: Multi-Point calibrated Optodes |
The name of the issue no longer is representative, since following the implementation of iterate_dimension (#57), this is a one-line action in a script. Still though, mission accomplished, so closing. |
Functionality to read in, manipulate, and calculate gain of oxygen has been built, but the end goal will be to adjust oxygen and/or the associated quality flags. Keep in mind that populating the _ADJUSTED field requires a change in DATA_MODE along with the population of _ADJUSTED_QC and _ADJUSTED_ERROR.
Plan to build the functions to write adjusted quantities and change or create new quality flags, but will not write to actual float file for now, will instead write to a local-only file with a Q*.nc prefix so that they are easy to keep track of, but this can be easily replaced with overwriting the file when the library is available for real use.
The text was updated successfully, but these errors were encountered: