-1

I tried to do normalized data(sfcWind) by the following codes as a new user. But it seems to be the incorrect results. Can anybody correct us

cdo timmax infil.nc Imax.nc

cdo timmin infil.nc Imin.nc

cdo sub Imax.nc Imin.nc A.nc

cdo sub infil.nc Imin.nc B.nc

cdo div A.nc B.nc N_sfcWind.nc
Abid
  • 3
  • 2
  • What is X.nc ? You use infil.nc in the first commands... are they the same thing? – ClimateUnboxed Nov 03 '22 at 09:30
  • ps: cdo.message is for an email tool, pls check tag metadata when tagging – ClimateUnboxed Nov 03 '22 at 09:40
  • Welcome to SO. This is primarily a coding site, so please explain what you mean by normalised, which is probably unclear to most – Robert Wilson Nov 03 '22 at 13:29
  • I want to do normalized data as shown in the following paper figure 3 (page number 5). https://doi.org/10.1016/j.atmosres.2021.105694 However, I feel the attached codes, data are not properly normalized (I mean my data only show positive and do not show any negative value after using these codes). Without normalized data shows positive and negative values but after normalized does not show negative values, only shows positive values why it happens I do not understand. – Abid Nov 04 '22 at 02:22
  • Please state this info in the question. It is unreasonable to provide a link and expect people to read it – Robert Wilson Nov 06 '22 at 14:45
  • @Abid, You posted your comment the day after I posted my answer that points out your error, maybe give feedback if this solved your problem (by accepting) or if not follow up why it didn't work? You state that the normalized variable is only positive, but the formula you are using is attempting to convert the value to one that spans the range 0-1. If instead you want to normalize by subtracting the mean and dividing by the standard deviation (that would give also negative vals) then you need to state this in the question. – ClimateUnboxed Nov 07 '22 at 21:57

1 Answers1

0

You are dividing the Xmax-Xmin by X-Xmin whereas it should be the other way around (X-Xmin)/(Xmax-Xmin). You also write X.nc and infil.nc and I think they are supposed to be the same thing!

I also note that this is normalization in time, not in space. If you are running this for space-time fields, that is quite unusual to do, are you sure you don't want to normalize in space? (i.e. fldmax instead of timmax etc).

If you really want normalization in time then:

If your data is in in.nc then you would use:

cdo timmax in.nc max.nc
cdo timmin in.nc min.nc 
cdo sub max.nc min.nc diff.nc 
cdo sub in.nc min.nc wind-min.nc 
cdo div wind-min.nc diff.nc v_norm.nc 

You can also use piping to make this shorter

cdo sub -timmax in.nx -timmin in.nc diff.nc 
cdo div -sub in.nc -timmin in.nc diff.nc norm.nc 

If the data is compressed then you also need to use -b f32 to convert to float and prevent an error.

ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86