Adding soil depth to two smap ioda converters#1075
Conversation
|
All, |
ClaraDraper-NOAA
left a comment
There was a problem hiding this comment.
Looks good to me, thanks @YoulongXia-NOAA
zcstanley
left a comment
There was a problem hiding this comment.
Thanks @YoulongXia-NOAA, this looks good to me as well!
|
Thank you, @ClaraDraper-NOAA and @zcstanley for your look. After Stephen takes a look and approves, I will be merged into the develop. In that case, you can test it for your practical application. |
|
@srherbener, do you have any chance to look at this PR? I know that you are very busy and therefore here just friendly asking and reminding if your time is available, please take a look. Thank you. |
srherbener
left a comment
There was a problem hiding this comment.
Thanks for updates. I have a couple suggestions that should eliminate unnecessary operations.
srherbener
left a comment
There was a problem hiding this comment.
Thanks for addressing my comments!
src/land/smap9km_ssm2ioda.py
Outdated
| ecoli = ncd.groups['Soil_Moisture_Retrieval_Data'].variables['EASE_column_index'][:].ravel() | ||
| refsec = ncd.groups['Soil_Moisture_Retrieval_Data'].variables['tb_time_seconds'][:].ravel() | ||
|
|
||
| deps = np.full_like(vals, 0.025) |
There was a problem hiding this comment.
what is the repeating value of 0.025 a default value? could this be set somewhere with a longer name?
There was a problem hiding this comment.
@BenjaminRuston, this is what Clara Drape @ClaraDraper-NOAA r asked me to do (see issue #1068.
src/land/smap_ssm2ioda.py
Outdated
| errs = ncd.groups['Soil_Moisture_Retrieval_Data'].variables['soil_moisture_error'][:].ravel() | ||
| qflg = ncd.groups['Soil_Moisture_Retrieval_Data'].variables['retrieval_qual_flag'][:].ravel() | ||
|
|
||
| deps = np.full_like(vals, 0.025) |
There was a problem hiding this comment.
here's that same value,,, may be good to centralize its value to a constant somewhere
There was a problem hiding this comment.
Not sure what this means. @ClaraDraper-NOAA, could you please give a response for this comment.
There was a problem hiding this comment.
Can we set a variable called:
assumed_obsevation_depth = 0.025 #observation assumed to be 2.5cm or 0.025m
and then use this in the two places where it appears... makes it easier to possible make this be something which can be passed in via yaml or arguments
There was a problem hiding this comment.
@BenjaminRuston, based on Greg Thomson's convention table, it is defined as depthBelowSoilSurface. Here is only abbreviation used in python code. In ioda netcdf4 file, its name is depthBelowSoilSurface.
There was a problem hiding this comment.
If you want me to add comments like this: deps = np.full_like(vals, 0.025) #observation assumed to be 0.025m, I can add it to my python code. Do you really want @BenjaminRuston?
There was a problem hiding this comment.
but the number 0.025 appears in two separate places so it seems like a good one to consolidate so they point to a single variable, don't you think?
sure using depthBelowSoilSurface is fine, but would you agree this may be better than having 0.025 hard coded in two separate locations.... and yes long names because someone new may not immediately know what deps means
There was a problem hiding this comment.
Okay, you mean that I can define it as assumed_obsevation_depth = 0.025 #observation assumed to be 2.5cm or 0.025m in the beginning of this python code, and then put the constant value via deps = np.full_like(vals, assumed_obsevation_depth), right? @BenjaminRuston
There was a problem hiding this comment.
@srherbener, in two separate locations.... , I do not understand this sentence. As there are two converters, one is for NRT SMAP data, and the other one is for 9km SMAP data. For each converter, it only uses once. I am not sure what do you want to consolidate? @ClaraDraper-NOAA, @zcstanley , or @srherbener, who can explain a bit more? I am confusing by this comment (I am sorry).
There was a problem hiding this comment.
@YoulongXia-NOAA no worries. I think what @BenjaminRuston means by "in two separate locations..." is that the hard coded value 0.025 appears once in each of the two scripts (smap9km_ssm2ioda.py and smap_ssm2ioda.py). I think what is being suggested is to have a parameter that is defined in only one place and used by both of the scripts.
We should have a common (shared) file for situations like this where you define common parameters to be used in multiple scripts. I'm not sure if we have that yet for the converters. This would be a nice long term solution.
Perhaps for the short term it would be acceptable to define the parameter at the beginning of each script so that if it ever gets used in multiple places within a script you've got an easier way to update the value. Thinking about a shared file perhaps a good name for the parameter would be something like assumedSoilDepth = 0.025. Then when the shared file scheme gets implemented, you would simply delete the setting of the parameter at the beginning to the two scripts and import the shared file with the parameter setting.
Setting up the shared parameter file could be done in a subsequent PR after this one.
Does this sound like an acceptable approach?
There was a problem hiding this comment.
Thank you, @srherbener. I do need to learn this part in the future. As I did not have such an experience, so that I could not catch the Ben's comments. Additionally, for the future update, I may also input it as parameter from start like this:
parser.add_argument('-D', '--depth',
help="assumedSoilDeppth", type=str, required=True)
in the code, convert string into float. This will leave it as input argument. Such a update will need the guidance and instructions. Thank you @BenjaminRuston for your comments and give a new view.
|
@YoulongXia-NOAA is there an associated ufo-data PR with the data for the ctest |
@BenjaminRuston, I only worked on ioda-comverter but not ufo-data. @ClaraDraper-NOAA, who will do this test? |
@YoulongXia-NOAA I wasn't aware that there was a second repo, but am assuming that ufo-data is where the output of the converters go (right, @BenjaminRuston ) , so I think you probably just need to create a second PR for that repo with. the updated output from the converter. |
|
@BenjaminRuston, I make changes here much faster than you create the new branch. I just need how to do such a change. Please review my changes and see if this is what you want me to do. Thank you. |
test/CMakeLists.txt
Outdated
| -i testinput/SMAP_L2_SM_P_E_36365_D_20211122T013945_R18240_001.h5 | ||
| -o testrun/smap9km_ssm.nc | ||
| -m maskout" | ||
| -m maskout |
There was a problem hiding this comment.
really think passing the string maskout is a bit odd and yes can change here but would recommend adding just the -m argument which changes a boolean to true and removing the depth entirely and have the default be in the python converter
it is potentially a bit hidden but do not want people thinking they can change the retrieval somehow
There was a problem hiding this comment.
@BenjaminRuston I'm also OK with hard coding the SMAP depth, since this is a fixed characteristic of L-band. The only reason I can think of that the observed depth would change would be if we changed the interpolation algorithms to no longer act on the midpoint of each layer - but this would be a much larger code change anyway. We might also want to trick the interpolation into using only model layer 1 in h(x), even if layer 1 is not 5 cm, by setting the observed depth to whatever the depth of layer 1 is, but this is an ugly work-around, so I think being forced to change the default value in this case is appropriate.
There was a problem hiding this comment.
@BenjaminRuston, I would rather than keep this flexibility for the user to avoid often modify code. We have a default option, if you select -m default. It is more flexible for the depth is not exact the same 0.025m, as Clara said for interpolation or something else. We can update README.md to tell the user how to use it. This should totally fine, I think.
There was a problem hiding this comment.
This is my opinion. If we want to update, certainly user friendly update is preferred.
There was a problem hiding this comment.
I do not think CMake is user friendly and a ctest is not what people should be modifying unless they are changing the file.
the converter should have the flexibility... I guess I will talk with Clara about this and we can make the call
There was a problem hiding this comment.
please change and remove the string argument maskout and make it a boolean
There was a problem hiding this comment.
if you like I can push changes up directly to your branch
|
Ben, please go ahead to fit push your change. We can discuss other part.
Thank you
On Tue, Oct 18, 2022 at 8:16 PM Benjamin Ruston ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In test/CMakeLists.txt
<#1075 (comment)>
:
> @@ -1745,7 +1746,8 @@ ecbuild_add_test( TARGET test_${PROJECT_NAME}_smap9km_ssm
"${Python3_EXECUTABLE} ${CMAKE_BINARY_DIR}/bin/smap9km_ssm2ioda.py
-i testinput/SMAP_L2_SM_P_E_36365_D_20211122T013945_R18240_001.h5
-o testrun/smap9km_ssm.nc
- -m maskout"
+ -m maskout
if you like I can push changes up directly to your branch
—
Reply to this email directly, view it on GitHub
<#1075 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMKGNUG6ZTAEH2E6OASCOELWD44XHANCNFSM6AAAAAAQ737MRE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
================================================================
Youlong Xia, Ph.D
SAIC at EMC/NCEP
5830 University Research Court
College Park, MD 20740
Phone: 301-683-3696
=================================================================
|
|
@BenjaminRuston, did you run ioda-bundle for thes etwo converters? They have errors below: |
|
@BenjaminRuston, I run ioda-bundle on Hera, get the same errors: File "/scratch2/NCEPDEV/stmp3/Youlong.Xia/CoverterSMAP/ioda-bundle/build/bin/smap_ssm2ioda.py", line 165, in main Could you please check which type is not correct? (I suspect type=bool, but I am not sure) |
|
@YoulongXia-NOAA yes you are correct the Please let me know if this is working for you, and feel free to make changes if you see a problem. |
|
@BenjaminRuston, thank you for you fixing this error. Now these converters pass ctests. I alsp update my local repository, and run them on Hera without error. I made corresponding changes for README.md to inform the users how to use these two converters. |
|
@BenjaminRuston, could you please approve this PR if you think that it is ready? If so, Steven @srherbener can merge it into develop so that Zofia @zcstanley can test for her application when his time is available. |
|
@YoulongXia-NOAA merging,, but note we should look to combine these converters as they only differ by about 12 lines! |
|
@BenjaminRuston, thank you for your merging. In general my land-related converters were following the previous examples I learnt from marine component when I started to work on ioda-converters in 2020. This time I got some new experience for ioda-converter. In future, I may need to modify them in the similar way here for the others when I need to update them. |
|
this is a soil moisture product but is a start toward the 9km Tb converter |
Description
Based on the land DA users' request, the soil depth named as depthBelowSurface was added into smap9km_ssm2ioda.py and smap_ssm2ioda.py. Note that this addition is created from the develop branch with out new conventions and standard modification.
Issue(s) addressed
Link the issues to be closed with this PR
Acceptance Criteria (Definition of Done)
ctest passed and updated covers are merged into the develop branch
Dependencies
No
Impact
No