[Thread Prev][Thread Next][Index]

Re: [las_users] Problem with regridding hybrid-z data to a fixed-z grid



Hi,

using version 7.0.beta of las and ferret 6.1 I got the regridding to pressure 
levels working by using Ferret init scripts.
You can find a documentation there: 
http://ferret.pmel.noaa.gov/LAS/documentation/installer-documentation/advanced-dataset-configuration/using-init_scripts-for-custom-ferret-behavior/
but here a bit more detailed how-to:

We are dealing with datasets on 90 levels which includes hybrid coefficients 
and surface pressure, so we are able to calculate pressure on these levels 
(here an example of CO):

 name     title                             I         J         K         L
 HYAM     hybrid A coefficient at layer m  ...       ...       1:90      ...
 HYBM     hybrid B coefficient at layer m  ...       ...       1:90      ...
 APS      surface pressure                 1:128     1:64      ...       1:148
 CO                                        1:128     1:64      1:90      1:148
 LON_002_001
                                           1:2       1:128     ...       ...
 LON_003_001
                                           1:3       1:128     ...       ...
 LAT_002_002
                                           1:2       1:64      ...       ...
 LAT_003_002
                                           1:3       1:64      ...       ...
 MLEV_003_003
                                           1:3       ...       1:90      ...

1. put a ferret script (.jnl) in the ferret-go search tree, so it can be found 
(or update FER_GO in FerretBackendConfig.xml at 
{LAS_HOME}/JavaSource/resources/ferret (I also included the path to the 
Ferret ini script in Ferret_config.pl in order to get the script found and 
ran configure (?)))

here an example init script (hybrid2press.jnl) for regridding above data to 
pressure levels:

 ! getting the url of netcdf file of variable (here: mc-file)
 set data ($data_url)
 set mem/size=80
 ! calculate pressure levels
 LET PRESS = (HYAM + HYBM * APS[k=1])/100
 ! define new z-axis of pressure levels
 DEFINE AXIS/Z/FROM_DATA/NAME=PAX/depth/units=hPa ((HYAM[d=1] + HYBM[d=1] * 
101325.)/100)
 ! output variable is variable from input with new z-axis
 let ($data_var) = ZAXREPLACE(($ferret_hz_var), press[d=1], Z[gz=pax])


2. edit your .xml file (las.xml or included entity file) like this (only 
datasets section shown, edit grids/axes sections accordingly):

 <datasets>
   <co_test name="Co Test data">
     <variables>
       <COP name="CO_p" units="mol/mol"
         url="file:mc/CO.mc">
	 <link match="/lasdata/grids/test_grid"/>
	 <properties>
	   <ferret>
	     <hz_var>CO</hz_var>
	     <init_script>hybrid2press</init_script>
	   </ferret>
	 </properties>
       </COP>
     </variables>
   </co_test>
 </datasets>

As you can see, you can access the xml structure through variables within the 
Ferret init script:
  $data_url --> <COP url="...">
  $data_var --> COP (name of variable in xml file)
  $ferret_hz_var --> <ferret><hz_var>...</hz_var></ferret>
(use the prefix ferret_ to address your variable in the <ferret></ferret> 
section).

Now we have a virtual variable COP with the data of CO and a new z-axis of 
pressure levels (something like that in the xml-file):
 <axes>
   [...]
   <mlev type="z" units="hPa">
     <v>0.01 </v>
     <v>0.032</v>
     <v>0.058</v>
   [...]
 </axes>

3. run genLas.pl las.xml to update your database.
You can edit the init script without running genLas.pl, the new version will 
be used if you update the plot.


Bastian


[Thread Prev][Thread Next][Index]


Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement