This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Maureen, Solaris is just a little more picky about having all the variables declared before the function in the ERMISS.FNC. You can move the line: REAL value, tval up 2 lines before the INCLUDE statements. Steve Chiswell Unidata User Support >From: Maureen Ballard <address@hidden> >Organization: UK Ag Weather Center >Keywords: 199901052049.NAA14088 >Steve, > >Well, I've made it as far as step 5. When I attempted to make all in the pr di > rectory, >I got the following error: > >dalton% make all >f77 -O -c prsoil.f >prsoil.f: > pr_soil: >"prsoil.f", line 29: Error: declaration among executables >*** Error code 1 >make: Fatal error: Command failed for target `/export/home/gempak/NAWIPS-5.4/l > ib >/sol/gemlib.a(prsoil.o)' > >Line 29 of prsoil.f is the >REAL value, tval >line - any ideas? > >Thanks! > >Maureen > >Unidata Support wrote: > >> Maureen, >> >> To calculate your PMSA (percent soil moisture availability) in >> GEMPAK surface programs, do the following: >> >> 1) Edit the $GEMTBL/parms/pcconv.tbl and add to the end: >> >> PSMA = PR_SOIL ( SOIL ) >> >> ----> The above line will tell GEMPAK that when you ask to plot PMSA, >> to use the parameter called SOIL, and do a calculation on it using >> the function PR_SOIL. If you call your soil moisture values something >> other than "SOIL", just substitute that name for the value >> of the parameter in the parentheses. >> >> 2) Edit the file $GEMPAKHOME/src/gemlib/pc/pcfunc.f and add the >> PR_SOIL call like: >> >> ...cut... >> ELSE IF ( fff .eq. 'PR_D100') THEN >> data ( iout (i) ) = PR_D100 (d1) >> C* >> ELSE IF ( fff .eq. 'PR_SOIL') THEN <-- add these 2 lines >> data ( iout (i) ) = PR_SOIL (d1) <--/ >> C* >> ELSE IF ( fff .eq. 'PR_M100') THEN >> data ( iout (i) ) = PR_M100 (d1) >> ...cut... >> >> 3) create $GEMPAKHOME/src/gemlib/pr/prsoil.f >> >> FUNCTION PR_SOIL ( value ) >> C************************************************************************ >> C* PR_SOIL * >> C* * >> C* This function computes soil moisture availability. * >> C* * >> C* PR_SOIL ( VALUE ) * >> C* * >> C* Input parameters: * >> C* VALUE REAL Value * >> C* * >> C* Output parameters: * >> C* PR_SOIL REAL * >> C* if (soil_moisture >.32) then * >> C* soil_moisture = .32 * >> C* else if (soil_moisture <.13) then * >> C* soil_moisture = .13 * >> C* end * >> C* * >> C* percent_of_soil_moisture available = * >> C* [(soil_moisture - 0.13)/0.19] *100 * >> C* * >> C** * >> C* Log: * >> C* Chiz/Unidata 01/99 Original source * >> C************************************************************************ >> INCLUDE 'GEMINC:GEMPRM.PRM' >> INCLUDE 'GEMINC:ERMISS.FNC' >> REAL value, tval >> C----------------------------------------------------------------------- >> C* Check for missing value. >> C >> tval = value >> IF ( ERMISS ( tval ) ) THEN >> PR_SOIL = RMISSD >> ELSE >> if (tval .gt. 0.32) tval = .32 >> if (tval .lt. 0.13) tval = .13 >> tval = (tval - .13)/.19 >> PR_SOIL = tval * 100. >> END IF >> C* >> RETURN >> END >> >> 4) Add the prsoil.o target to the Makefile in the PR subdirectory (tabs >> are important in Makefiles! >> >> ...cut... >> $(ALIB)(prskyx.o) \ >> "tab" $(ALIB)(prsoil.o) \ <--- add this target >> $(ALIB)(prsped.o) \ >> ...cut... >> >> 5) compile the 2 fortran routines >> >> cd $GEMPAKHOME/src/gemlib/pr >> make clean >> make all >> make clean >> >> cd $GEMPAKHOME/src/gemlib/pc >> make clean >> make all >> make clean >> >> 6) Now recompile and install the surface programs (like sfmap and sflist) th > at >> you want to be able to use your function >> >> cd $GEMPAKHOME/src/programs/sf >> make clean >> make all >> make install >> make clean >> >> 7) Your done. Now, in any surface file you have the parameter "SOIL" in, >> you can plot, list, graph PSMA simply by using SFPARM=PSMA >> >> Once you have compiled the routines, the pcconv.tbl table is the only >> place you have to change if you call your parameter something >> other than "SOIL". >> >> If you have lots of variables for soil moisture, for example at different > depths >> like SOL2, SOL4, SOL6 for 2, 4 and 6 inches respectively, then you would > add a >> line for each calc in the pcconv.tbl >> PSM2 = PR_SOIL ( SOL2 ) >> PSM4 = PR_SOIL ( SOL4 ) >> PSM6 = PR_SOIL ( SOL6 ) >> >> ** Note, I made the assumption you meant "if moisture < .13, moisture = .13 >> in your message below for the subroutine above. >> >> Steve Chiswell >> Unidata User Support >> >> >From: Maureen Moore <address@hidden> >> >Organization: UK Ag Weather Center >> >Keywords: 199812092008.NAA15361 >> >> >Steve, >> > >> >I had written before about what my options were to create a mph - knot >> >conversion within GEMPAK. I chose the easier of the two options at the >> >time but now I think I have a use for actually creating a library >> >function. >> > >> >Let me give you a quick background on what I need. We have some research >> >stations that are geared for agricultural use and 2 of the sensors read >> >soil moisture. This soil moisture value can be any where in between 0.00 >> >and 0.50. For agricultural purposes, the first 0.13 inches are not >> >available and the most that can be taken is up to 0.32 inches. (I'm >> >still learning about this so if that was unclear, sorry!) We want to be >> >able to plot these values as a percentage but there is a little math >> >involved prior to multiplying by 100. >> > >> >Logically, what I need to be able to do is the following: >> > >> >if (soil_moisture >.32) then >> > soil_moisture = .32 >> >else if (soil_moisture <.13) then >> > soil_moisture = 0 >> >end >> > >> >percent_of_soil_moisture available = [(soil_moisture - 0.13)/0.19] *100 >> > >> > >> >Would I be correct in saying that this could be written into GEMPAK as a >> >library function? Looking at the files in the $GEMPAKHOME/src/gemlib/pr/ >> >I see that about half of them are ascii files and the remaining are >> >fortran programs. If I do need to develop a library function, would it >> >have to be in fortran? >> > >> >Thanks for any help on this one. It took us a while to put in the 2 soil >> >moisture probes (one at 4 inches and the other at 30) and we will be >> >adding a 3rd one for in between. We then have 2 other stations which >> >will be receiving the probes soon (hopefully!) >> > >> >Any guidance would be greatly appreciated! >> > >> >Maureen >> > >> >-- >> >======================================================================== >> > >> >Maureen Moore Ballard address@hidden >> >Staff Meteorologist ph: 606-257-3000ext244 >> >Ag. Weather Center fax: 606-257-5671 >> >243 Ag. Engineering Bldg >> >Dept. of Biosystems and Ag. Engr. >> >University of Kentucky >> >Lexington, KY 40546-0276 >> >HOMEPAGE http://wwwagwx.ca.uky.edu >> >========================================================================= >> > >> > >> > >> >> **************************************************************************** >> Unidata User Support UCAR Unidata Program >> (303)497-8644 P.O. Box 3000 >> address@hidden Boulder, CO 80307 >> ---------------------------------------------------------------------------- >> Unidata WWW Service http://www.unidata.ucar.edu/ >> **************************************************************************** > > > >-- >======================================================================== >Maureen Moore Ballard address@hidden >Staff Meteorologist ph: 606-257-3000ext244 >Ag. Weather Center fax: 606-257-5671 >243 Ag. Engineering Bldg >Dept. of Biosystems and Ag. Engr. >University of Kentucky >Lexington, KY 40546-0276 >HOMEPAGE http://wwwagwx.ca.uky.edu >========================================================================= > >